Skip to content

Commit 1e760ba

Browse files
author
Kirill Novinskiy
committed
Merge remote-tracking branch 'origin/release_25.9.0' into develop
2 parents 12d1d2a + 5b1ce9b commit 1e760ba

File tree

7 files changed

+233
-11
lines changed

7 files changed

+233
-11
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ 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 25.8
34-
- Implement document page resize functionality using the Pdf.Cloud API library.
33+
## Enhancements in Version 25.9
34+
- Implement PDF document page crop functionality using the Pdf.Cloud API library.
3535
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3636

37-
## Bugs fixed in Version 25.8
38-
- Implement delete watermark from PDF document using the Pdf.Cloud API library.
39-
4037
## Installation
4138
To install the API client library to your local Maven repository, simply execute:
4239

@@ -59,7 +56,7 @@ Add this dependency to your project's POM:
5956
<dependency>
6057
<groupId>com.aspose</groupId>
6158
<artifactId>aspose-cloud-pdf</artifactId>
62-
<version>25.8.0</version>
59+
<version>25.9.0</version>
6360
<scope>compile</scope>
6461
</dependency>
6562
```
@@ -68,7 +65,7 @@ Add this dependency to your project's POM:
6865
Add this dependency to your project's build file:
6966

7067
```groovy
71-
compile "com.aspose:aspose-cloud-pdf:25.8.0"
68+
compile "com.aspose:aspose-cloud-pdf:25.9.0"
7269
```
7370

7471
### Others
@@ -78,7 +75,7 @@ At first generate the JAR by executing:
7875

7976
Then manually install the following JARs:
8077

81-
* target/aspose-cloud-pdf-25.8.0.jar
78+
* target/aspose-cloud-pdf-25.9.0.jar
8279
* target/lib/*.jar
8380

8481
## Getting Started

build.gradle

Lines changed: 1 addition & 1 deletion
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 = '25.8.0'
23+
version = '25.9.0'
2424

2525
buildscript {
2626
repositories {

docs/PdfApi.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Method | HTTP request | Description
212212
[**postDocumentImageStamps**](PdfApi.md#postDocumentImageStamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
213213
[**postDocumentImageStampsPageSpecified**](PdfApi.md#postDocumentImageStampsPageSpecified) | **POST** /pdf/\{name}/stamps/image/pagespecified | Add document image stamps to specified pages.
214214
[**postDocumentPageNumberStamps**](PdfApi.md#postDocumentPageNumberStamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
215+
[**postDocumentPagesCrop**](PdfApi.md#postDocumentPagesCrop) | **POST** /pdf/\{name}/crop | Crop PDF document pages.
215216
[**postDocumentPagesResize**](PdfApi.md#postDocumentPagesResize) | **POST** /pdf/\{name}/resize | Rsize PDF document.
216217
[**postDocumentPagesRotate**](PdfApi.md#postDocumentPagesRotate) | **POST** /pdf/\{name}/rotate | Rotate PDF document.
217218
[**postDocumentTextFooter**](PdfApi.md#postDocumentTextFooter) | **POST** /pdf/\{name}/footer/text | Add document text footer.
@@ -5449,6 +5450,32 @@ Name | Type | Description | Notes
54495450

54505451
[**AsposeResponse**](AsposeResponse.md)
54515452

5453+
### HTTP request headers
5454+
5455+
- **Content-Type**: application/json
5456+
- **Accept**: application/json
5457+
5458+
<a name="postDocumentPagesCrop"></a>
5459+
# **postDocumentPagesCrop**
5460+
> AsposeResponse postDocumentPagesCrop(name, pages, rect, storage, folder, password)
5461+
5462+
Crop PDF document pages.
5463+
5464+
### Parameters
5465+
5466+
Name | Type | Description | Notes
5467+
------------- | ------------- | ------------- | -------------
5468+
**name** | **String**| The document name. |
5469+
**pages** | **String**| Comma separated list of pages and page ranges. (Example: 1,3-5,8) |
5470+
**rect** | [**Rectangle**](Rectangle.md)| Rectangle of document area. |
5471+
**storage** | **String**| The document storage. | [optional]
5472+
**folder** | **String**| The document folder. | [optional]
5473+
**password** | **String**| Base64 encoded password. | [optional]
5474+
5475+
### Return type
5476+
5477+
[**AsposeResponse**](AsposeResponse.md)
5478+
54525479
### HTTP request headers
54535480

54545481
- **Content-Type**: application/json

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>25.8.0</version>
9+
<version>25.9.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public ApiClient() {
9494

9595
// Add custom headers
9696
addDefaultHeader("x-aspose-client", "java sdk");
97-
addDefaultHeader("x-aspose-client-version", "25.8.0");
97+
addDefaultHeader("x-aspose-client-version", "25.9.0");
9898

9999
// PDFCLOUD-418 Set default Connect Timeout
100100
setConnectTimeout(5 * 60 * 1000);

src/main/java/com/aspose/asposecloudpdf/api/PdfApi.java

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
import com.aspose.asposecloudpdf.model.RadioButtonField;
128128
import com.aspose.asposecloudpdf.model.RadioButtonFieldResponse;
129129
import com.aspose.asposecloudpdf.model.RadioButtonFieldsResponse;
130+
import com.aspose.asposecloudpdf.model.Rectangle;
130131
import com.aspose.asposecloudpdf.model.RedactionAnnotation;
131132
import com.aspose.asposecloudpdf.model.RedactionAnnotationResponse;
132133
import com.aspose.asposecloudpdf.model.RedactionAnnotationsResponse;
@@ -33261,6 +33262,180 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
3326133262
apiClient.executeAsync(call, localVarReturnType, callback);
3326233263
return call;
3326333264
}
33265+
/**
33266+
* Build call for postDocumentPagesCrop
33267+
* @param name The document name. (required)
33268+
* @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
33269+
* @param rect Rectangle of document area. (required)
33270+
* @param storage The document storage. (optional)
33271+
* @param folder The document folder. (optional)
33272+
* @param password Base64 encoded password. (optional)
33273+
* @param progressListener Progress listener
33274+
* @param progressRequestListener Progress request listener
33275+
* @return Call to execute
33276+
* @throws ApiException If fail to serialize the request body object
33277+
*/
33278+
public com.squareup.okhttp.Call postDocumentPagesCropCall(String name, String pages, Rectangle rect, String storage, String folder, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
33279+
Object localVarPostBody = rect;
33280+
33281+
// create path and map variables
33282+
String localVarPath = "/pdf/{name}/crop"
33283+
.replaceAll("\\{" + "name" + "\\}", apiClient.escapePathSegmentString(name.toString()));
33284+
33285+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
33286+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
33287+
if (pages != null)
33288+
localVarQueryParams.addAll(apiClient.parameterToPair("pages", pages));
33289+
if (storage != null)
33290+
localVarQueryParams.addAll(apiClient.parameterToPair("storage", storage));
33291+
if (folder != null)
33292+
localVarQueryParams.addAll(apiClient.parameterToPair("folder", folder));
33293+
if (password != null)
33294+
localVarQueryParams.addAll(apiClient.parameterToPair("password", password));
33295+
33296+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
33297+
33298+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
33299+
33300+
final String[] localVarAccepts = {
33301+
"application/json"
33302+
};
33303+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
33304+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
33305+
33306+
final String[] localVarContentTypes = {
33307+
"application/json"
33308+
};
33309+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
33310+
localVarHeaderParams.put("Content-Type", localVarContentType);
33311+
33312+
if(progressListener != null) {
33313+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
33314+
@Override
33315+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
33316+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
33317+
return originalResponse.newBuilder()
33318+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
33319+
.build();
33320+
}
33321+
});
33322+
}
33323+
33324+
String[] localVarAuthNames = new String[] { "JWT" };
33325+
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
33326+
}
33327+
33328+
@SuppressWarnings("rawtypes")
33329+
private com.squareup.okhttp.Call postDocumentPagesCropValidateBeforeCall(String name, String pages, Rectangle rect, String storage, String folder, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
33330+
33331+
// verify the required parameter 'name' is set
33332+
if (name == null) {
33333+
throw new ApiException("Missing the required parameter 'name' when calling postDocumentPagesCrop(Async)");
33334+
}
33335+
33336+
// verify the required parameter 'pages' is set
33337+
if (pages == null) {
33338+
throw new ApiException("Missing the required parameter 'pages' when calling postDocumentPagesCrop(Async)");
33339+
}
33340+
33341+
// verify the required parameter 'rect' is set
33342+
if (rect == null) {
33343+
throw new ApiException("Missing the required parameter 'rect' when calling postDocumentPagesCrop(Async)");
33344+
}
33345+
33346+
33347+
com.squareup.okhttp.Call call = postDocumentPagesCropCall(name, pages, rect, storage, folder, password, progressListener, progressRequestListener);
33348+
return call;
33349+
33350+
}
33351+
33352+
/**
33353+
* Crop PDF document pages.
33354+
*
33355+
* @param name The document name. (required)
33356+
* @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
33357+
* @param rect Rectangle of document area. (required)
33358+
* @param storage The document storage. (optional)
33359+
* @param folder The document folder. (optional)
33360+
* @param password Base64 encoded password. (optional)
33361+
* @return AsposeResponse
33362+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
33363+
*/
33364+
public AsposeResponse postDocumentPagesCrop(String name, String pages, Rectangle rect, String storage, String folder, String password) throws ApiException {
33365+
try
33366+
{
33367+
ApiResponse<AsposeResponse> resp = postDocumentPagesCropWithHttpInfo(name, pages, rect, storage, folder, password);
33368+
return resp.getData();
33369+
}
33370+
catch (ApiException ex)
33371+
{
33372+
if (ex.getCode() == 401)
33373+
{
33374+
apiClient.requestToken();
33375+
ApiResponse<AsposeResponse> resp = postDocumentPagesCropWithHttpInfo(name, pages, rect, storage, folder, password);
33376+
return resp.getData();
33377+
}
33378+
throw ex;
33379+
}
33380+
}
33381+
33382+
/**
33383+
* Crop PDF document pages.
33384+
*
33385+
* @param name The document name. (required)
33386+
* @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
33387+
* @param rect Rectangle of document area. (required)
33388+
* @param storage The document storage. (optional)
33389+
* @param folder The document folder. (optional)
33390+
* @param password Base64 encoded password. (optional)
33391+
* @return ApiResponse&lt;AsposeResponse&gt;
33392+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
33393+
*/
33394+
public ApiResponse<AsposeResponse> postDocumentPagesCropWithHttpInfo(String name, String pages, Rectangle rect, String storage, String folder, String password) throws ApiException {
33395+
com.squareup.okhttp.Call call = postDocumentPagesCropValidateBeforeCall(name, pages, rect, storage, folder, password, null, null);
33396+
Type localVarReturnType = new TypeToken<AsposeResponse>(){}.getType();
33397+
return apiClient.execute(call, localVarReturnType);
33398+
}
33399+
33400+
/**
33401+
* Crop PDF document pages. (asynchronously)
33402+
*
33403+
* @param name The document name. (required)
33404+
* @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
33405+
* @param rect Rectangle of document area. (required)
33406+
* @param storage The document storage. (optional)
33407+
* @param folder The document folder. (optional)
33408+
* @param password Base64 encoded password. (optional)
33409+
* @param callback The callback to be executed when the API call finishes
33410+
* @return The request call
33411+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
33412+
*/
33413+
public com.squareup.okhttp.Call postDocumentPagesCropAsync(String name, String pages, Rectangle rect, String storage, String folder, String password, final ApiCallback<AsposeResponse> callback) throws ApiException {
33414+
33415+
ProgressResponseBody.ProgressListener progressListener = null;
33416+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
33417+
33418+
if (callback != null) {
33419+
progressListener = new ProgressResponseBody.ProgressListener() {
33420+
@Override
33421+
public void update(long bytesRead, long contentLength, boolean done) {
33422+
callback.onDownloadProgress(bytesRead, contentLength, done);
33423+
}
33424+
};
33425+
33426+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
33427+
@Override
33428+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
33429+
callback.onUploadProgress(bytesWritten, contentLength, done);
33430+
}
33431+
};
33432+
}
33433+
33434+
com.squareup.okhttp.Call call = postDocumentPagesCropValidateBeforeCall(name, pages, rect, storage, folder, password, progressListener, progressRequestListener);
33435+
Type localVarReturnType = new TypeToken<AsposeResponse>(){}.getType();
33436+
apiClient.executeAsync(call, localVarReturnType, callback);
33437+
return call;
33438+
}
3326433439
/**
3326533440
* Build call for postDocumentPagesResize
3326633441
* @param name The document name. (required)

src/test/java/com/aspose/asposecloudpdf/api/DocumentTests.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,27 @@ public void postDocumentPagesResizeTest() throws ApiException
337337
AsposeResponse response = th.pdfApi.postDocumentPagesResize(name, 100., 200., "2-3", null, folder, null);
338338
assertEquals(200, (int)response.getCode());
339339
}
340+
341+
/**
342+
* PostDocumentPagesCrop Test
343+
* @throws ApiException
344+
* if the Api call fails
345+
*/
346+
347+
@Test
348+
public void postDocumentPagesCropTest() throws ApiException
349+
{
350+
String name = "4pages.pdf";
351+
th.uploadFile(name);
352+
353+
String folder = th.tempFolder;
354+
355+
Rectangle rect = new Rectangle()
356+
.LLX(0.)
357+
.LLY(0.)
358+
.URX(800.)
359+
.URY(400.);
360+
AsposeResponse response = th.pdfApi.postDocumentPagesCrop(name, "2-3", rect, null, folder, null);
361+
assertEquals(200, (int)response.getCode());
362+
}
340363
}

0 commit comments

Comments
 (0)