Skip to content

Commit 0e820a2

Browse files
authored
Merge pull request #67 from aspose-pdf-cloud/develop
update to 24.3
2 parents ee74c9b + b4a3575 commit 0e820a2

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

README.md

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

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

3736
## Installation
@@ -56,7 +55,7 @@ Add this dependency to your project's POM:
5655
<dependency>
5756
<groupId>com.aspose</groupId>
5857
<artifactId>aspose-cloud-pdf</artifactId>
59-
<version>24.2.0</version>
58+
<version>24.3.0</version>
6059
<scope>compile</scope>
6160
</dependency>
6261
```
@@ -65,7 +64,7 @@ Add this dependency to your project's POM:
6564
Add this dependency to your project's build file:
6665

6766
```groovy
68-
compile "com.aspose:aspose-cloud-pdf:24.2.0"
67+
compile "com.aspose:aspose-cloud-pdf:24.3.0"
6968
```
7069

7170
### Others
@@ -75,7 +74,7 @@ At first generate the JAR by executing:
7574

7675
Then manually install the following JARs:
7776

78-
* target/aspose-cloud-pdf-24.2.0.jar
77+
* target/aspose-cloud-pdf-24.3.0.jar
7978
* target/lib/*.jar
8079

8180
## Getting Started
@@ -93,7 +92,7 @@ public class PdfApiExample {
9392

9493
public static void main(String[] args) {
9594
// Get App key and App SID from https://cloud.aspose.com
96-
PdfApi apiInstance = new PdfApi("app_key", "app_sid");
95+
PdfApi apiInstance = new PdfApi("MY_APP_KEY", "MY_APP_SID");
9796
String name = "name_example"; // String | The document name.
9897
String fieldName = "fieldName_example"; // String | The field name/
9998
String storage = "storage_example"; // String | The document storage.
@@ -109,6 +108,12 @@ public class PdfApiExample {
109108
}
110109
```
111110

111+
## SelfHost Aspose.PDF Cloud
112+
Create **PdfApi** object with one *host* parameter:
113+
```java
114+
PdfApi apiInstance = new PdfApi("MY_SELFHOST_URL");
115+
```
116+
112117
## Unit Tests
113118
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.
114119

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 {
@@ -84,7 +84,7 @@ dependencies {
8484
publish {
8585
groupId = 'com.aspose'
8686
artifactId = 'aspose-pdf-cloud'
87-
publishVersion = '24.2.0'
87+
publishVersion = '24.3.0'
8888
desc = 'Aspose.PDF Cloud is a REST API for creating and editing PDF files. Most popular features proposed by Aspose.PDF Cloud: PDF to Word, Convert PDF to Image, Merge PDF, Split PDF, Add Images to PDF, Rotate PDF. 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.'
8989
licences = ['MIT']
9090
website = 'https://products.aspose.cloud/pdf/cloud'

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<artifactId>aspose-pdf-cloud</artifactId>
77
<packaging>jar</packaging>
88
<name>aspose-pdf-cloud</name>
9-
<version>24.2.0</version>
9+
<version>24.3.0</version>
1010
<url>https://www.aspose.cloud/</url>
1111
<description>Aspose.PDF Cloud is a REST API for creating and editing PDF files.
1212
Most popular features proposed by Aspose.PDF Cloud: PDF to Word, Convert PDF to Image, Merge PDF, Split PDF, Add Images to PDF, Rotate PDF.

src/main/java/com/aspose/asposecloudpdf/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", "java 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);

src/main/java/com/aspose/asposecloudpdf/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
}

src/test/java/com/aspose/asposecloudpdf/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)