Skip to content

Commit cfccdeb

Browse files
authored
Merge pull request #70 from aspose-pdf-cloud/develop
update to 24.3
2 parents 76b98d4 + ad23a94 commit cfccdeb

File tree

5 files changed

+42
-9
lines changed

5 files changed

+42
-9
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
2929
## Read PDF Formats
3030
MHT, PCL, PS, XSLFO, MD
3131

32-
## Enhancements in Version 24.2
33-
- Memory leak when converting PDF to DOCX.
32+
## Enhancements in Version 24.3
3433
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3534

3635
## Requirements
@@ -96,6 +95,12 @@ Please follow the [installation](#installation) instruction and execute the foll
9695
com.squareup.okhttp.Call result = pdfApi.deleteField(name, fieldName, storage, folder);
9796
```
9897

98+
## SelfHost Aspose.PDF Cloud
99+
Create **PdfApi** object with one *host* parameter:
100+
```java
101+
PdfApi pdfApi = new PdfApi("MY_SELFHOST_URL");
102+
```
103+
99104
## Unit Tests
100105
Aspose PDF Cloud SDK includes a suite of unit tests within the "test" subdirectory. These Unit Tests also serves as examples of how to use the Aspose PDF Cloud SDK.
101106

sdk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ apply plugin: 'idea'
2020
apply plugin: 'eclipse'
2121

2222
group = 'com.aspose'
23-
version = '24.2.0'
23+
version = '24.3.0'
2424

2525
buildscript {
2626
repositories {
@@ -100,7 +100,7 @@ dependencies {
100100
publish {
101101
groupId = 'com.aspose'
102102
artifactId = 'aspose-cloud-pdf-android'
103-
publishVersion = '24.2.0'
103+
publishVersion = '24.3.0'
104104
desc = 'Aspose.PDF Cloud is a REST API for creating and editing PDF files. It can also be used to convert PDF files to different formats like DOC, HTML, XPS, TIFF and many more. Aspose.PDF Cloud gives you control: create PDFs from scratch or from HTML, XML, template, database, XPS or an image. Render PDFs to image formats such as JPEG, PNG, GIF, BMP, TIFF and many others. Aspose.PDF Cloud helps you manipulate elements of a PDF file like text, annotations, watermarks, signatures, bookmarks, stamps and so on. Its REST API also allows you to manage PDF pages by using features like merging, splitting, and inserting. Add images to a PDF file or convert PDF pages to images.'
105105
licences = ['MIT']
106106
website = 'https://products.aspose.cloud/pdf/cloud'

sdk/src/main/java/com/aspose/asposecloudpdfandroid/ApiClient.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
public class ApiClient {
6464

65+
private Boolean selfHost = false;
6566
private String basePath = "https://api.aspose.cloud/v3.0";
6667
private boolean debugging = false;
6768
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
@@ -92,13 +93,23 @@ public ApiClient() {
9293

9394
// Add custom headers
9495
addDefaultHeader("x-aspose-client", "android sdk");
95-
addDefaultHeader("x-aspose-client-version", "24.2.0");
96+
addDefaultHeader("x-aspose-client-version", "24.3.0");
9697

9798
// PDFCLOUD-418 Set default Connect Timeout
9899
setConnectTimeout(5 * 60 * 1000);
99100
setReadTimeout(5 * 60 * 1000);
100101
}
101102

103+
/**
104+
* Set SelfHost
105+
*
106+
* @param selfHost SelfHost
107+
*/
108+
public void setSelfHost(Boolean selfHost)
109+
{
110+
this.selfHost = selfHost;
111+
}
112+
102113
/**
103114
* Get App Key
104115
*
@@ -856,7 +867,9 @@ public Call buildCall(String path, String method, List<Pair> queryParams, List<P
856867
* @throws ApiException If fail to serialize the request body object
857868
*/
858869
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
859-
addOAuthAuthentication(headerParams);
870+
if (!selfHost) {
871+
addOAuthAuthentication(headerParams);
872+
}
860873
final String url = buildUrl(path, queryParams, collectionQueryParams);
861874
final Request.Builder reqBuilder = new Request.Builder().url(url);
862875
processHeaderParams(headerParams, reqBuilder);

sdk/src/main/java/com/aspose/asposecloudpdfandroid/api/PdfApi.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,17 @@ public class PdfApi {
187187

188188
public PdfApi(String appKey, String appSid) {
189189
this(Configuration.getDefaultApiClient());
190+
apiClient.setSelfHost(false);
190191
apiClient.setAppKey(appKey);
191192
apiClient.setAppSid(appSid);
192193
}
193194

195+
public PdfApi(String host) {
196+
this(Configuration.getDefaultApiClient());
197+
apiClient.setSelfHost(true);
198+
apiClient.setBasePath(host);
199+
}
200+
194201
public PdfApi(ApiClient apiClient) {
195202
this.apiClient = apiClient;
196203
}

sdk/src/test/java/com/aspose/asposecloudpdfandroid/api/TestHelper.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class TestHelper {
1818
public static String setupFile = "..\\..\\..\\Settings\\servercreds.json";
1919

2020
class ApiCreds{
21+
public Boolean SelfHost = false;
2122
public String AppKey;
2223
public String AppSID;
2324
public String ProductUri;
@@ -36,16 +37,23 @@ public static TestHelper getInstance() throws ApiException
3637
private TestHelper() throws ApiException
3738
{
3839
TestHelper.ApiCreds apiCreds = getApiCreds();
39-
pdfApi = new PdfApi(apiCreds.AppKey, apiCreds.AppSID);
40-
pdfApi.getApiClient().setBasePath(apiCreds.ProductUri);
40+
if (apiCreds.SelfHost) {
41+
pdfApi = new PdfApi(apiCreds.ProductUri);
42+
} else {
43+
pdfApi = new PdfApi(apiCreds.AppKey, apiCreds.AppSID);
44+
}
4145
}
4246

4347
private TestHelper.ApiCreds getApiCreds() throws ApiException
4448
{
4549
Gson gson = new Gson();
4650
try {
4751
JsonReader reader = new JsonReader(new FileReader(setupFile));
48-
return gson.fromJson(reader, TestHelper.ApiCreds.class);
52+
TestHelper.ApiCreds creds = gson.fromJson(reader, TestHelper.ApiCreds.class);
53+
if (creds.SelfHost == null) {
54+
creds.SelfHost = false;
55+
}
56+
return creds;
4957
}
5058
catch (FileNotFoundException ex){
5159
throw new ApiException(ex.getMessage());

0 commit comments

Comments
 (0)