Skip to content

Commit eb7cc82

Browse files
author
Kirill Novinskiy
committed
Merge remote-tracking branch 'origin/release_25.9.0' into develop
2 parents 4559c14 + 691567d commit eb7cc82

File tree

7 files changed

+175
-8
lines changed

7 files changed

+175
-8
lines changed

README.md

Lines changed: 2 additions & 5 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
## Requirements.
4138
Python 2.7 and 3.4+
4239

asposepdfcloud/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, app_key, app_sid, host=None, self_host=False):
8383
self.rest_client = RESTClientObject()
8484
self.default_headers = {}
8585
self.default_headers['x-aspose-client'] = 'python sdk'
86-
self.default_headers['x-aspose-client-version'] = '25.8.0'
86+
self.default_headers['x-aspose-client-version'] = '25.9.0'
8787

8888
self.self_host = self_host
8989
self.app_key = app_key

asposepdfcloud/apis/pdf_api.py

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24907,6 +24907,136 @@ def post_document_page_number_stamps_with_http_info(self, name, stamp, **kwargs)
2490724907
_request_timeout=params.get('_request_timeout'),
2490824908
collection_formats=collection_formats)
2490924909

24910+
def post_document_pages_crop(self, name, pages, rect, **kwargs):
24911+
"""
24912+
Crop PDF document pages.
24913+
This method makes a synchronous HTTP request by default. To make an
24914+
asynchronous HTTP request, please define a `callback` function
24915+
to be invoked when receiving the response.
24916+
>>> def callback_function(response):
24917+
>>> pprint(response)
24918+
>>>
24919+
>>> thread = api.post_document_pages_crop(name, pages, rect, callback=callback_function)
24920+
24921+
:param callback function: The callback function
24922+
for asynchronous request. (optional)
24923+
:param str name: The document name. (required)
24924+
:param str pages: Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
24925+
:param Rectangle rect: Rectangle of document area. (required)
24926+
:param str storage: The document storage.
24927+
:param str folder: The document folder.
24928+
:param str password: Base64 encoded password.
24929+
:return: AsposeResponse
24930+
If the method is called asynchronously,
24931+
returns the request thread.
24932+
"""
24933+
kwargs['_return_http_data_only'] = True
24934+
if kwargs.get('callback'):
24935+
return self.post_document_pages_crop_with_http_info(name, pages, rect, **kwargs)
24936+
else:
24937+
(data) = self.post_document_pages_crop_with_http_info(name, pages, rect, **kwargs)
24938+
return data
24939+
24940+
def post_document_pages_crop_with_http_info(self, name, pages, rect, **kwargs):
24941+
"""
24942+
Crop PDF document pages.
24943+
This method makes a synchronous HTTP request by default. To make an
24944+
asynchronous HTTP request, please define a `callback` function
24945+
to be invoked when receiving the response.
24946+
>>> def callback_function(response):
24947+
>>> pprint(response)
24948+
>>>
24949+
>>> thread = api.post_document_pages_crop_with_http_info(name, pages, rect, callback=callback_function)
24950+
24951+
:param callback function: The callback function
24952+
for asynchronous request. (optional)
24953+
:param str name: The document name. (required)
24954+
:param str pages: Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required)
24955+
:param Rectangle rect: Rectangle of document area. (required)
24956+
:param str storage: The document storage.
24957+
:param str folder: The document folder.
24958+
:param str password: Base64 encoded password.
24959+
:return: AsposeResponse
24960+
If the method is called asynchronously,
24961+
returns the request thread.
24962+
"""
24963+
24964+
all_params = ['name', 'pages', 'rect', 'storage', 'folder', 'password']
24965+
all_params.append('callback')
24966+
all_params.append('_return_http_data_only')
24967+
all_params.append('_preload_content')
24968+
all_params.append('_request_timeout')
24969+
24970+
params = locals()
24971+
for key, val in iteritems(params['kwargs']):
24972+
if key not in all_params:
24973+
raise TypeError(
24974+
"Got an unexpected keyword argument '%s'"
24975+
" to method post_document_pages_crop" % key
24976+
)
24977+
params[key] = val
24978+
del params['kwargs']
24979+
# verify the required parameter 'name' is set
24980+
if ('name' not in params) or (params['name'] is None):
24981+
raise ValueError("Missing the required parameter `name` when calling `post_document_pages_crop`")
24982+
# verify the required parameter 'pages' is set
24983+
if ('pages' not in params) or (params['pages'] is None):
24984+
raise ValueError("Missing the required parameter `pages` when calling `post_document_pages_crop`")
24985+
# verify the required parameter 'rect' is set
24986+
if ('rect' not in params) or (params['rect'] is None):
24987+
raise ValueError("Missing the required parameter `rect` when calling `post_document_pages_crop`")
24988+
24989+
24990+
collection_formats = {}
24991+
24992+
path_params = {}
24993+
if 'name' in params:
24994+
path_params['name'] = params['name']
24995+
24996+
query_params = []
24997+
if 'pages' in params:
24998+
query_params.append(('pages', params['pages']))
24999+
if 'storage' in params:
25000+
query_params.append(('storage', params['storage']))
25001+
if 'folder' in params:
25002+
query_params.append(('folder', params['folder']))
25003+
if 'password' in params:
25004+
query_params.append(('password', params['password']))
25005+
25006+
header_params = {}
25007+
25008+
form_params = []
25009+
local_var_files = {}
25010+
25011+
body_params = None
25012+
if 'rect' in params:
25013+
body_params = params['rect']
25014+
# HTTP header `Accept`
25015+
header_params['Accept'] = self.api_client.\
25016+
select_header_accept(['application/json'])
25017+
25018+
# HTTP header `Content-Type`
25019+
header_params['Content-Type'] = self.api_client.\
25020+
select_header_content_type(['application/json'])
25021+
25022+
# Authentication setting
25023+
auth_settings = ['JWT']
25024+
25025+
return self.api_client.call_api('/pdf/{name}/crop', 'POST',
25026+
path_params,
25027+
query_params,
25028+
header_params,
25029+
body=body_params,
25030+
post_params=form_params,
25031+
files=local_var_files,
25032+
response_type='AsposeResponse',
25033+
auth_settings=auth_settings,
25034+
callback=params.get('callback'),
25035+
_return_http_data_only=params.get('_return_http_data_only'),
25036+
_preload_content=params.get('_preload_content', True),
25037+
_request_timeout=params.get('_request_timeout'),
25038+
collection_formats=collection_formats)
25039+
2491025040
def post_document_pages_resize(self, name, height, width, pages, **kwargs):
2491125041
"""
2491225042
Rsize PDF document.

asposepdfcloud/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,5 @@ def to_debug_report(self):
199199
"OS: {env}\n"\
200200
"Python Version: {pyversion}\n"\
201201
"Version of the API: 3.0\n"\
202-
"SDK Package Version: 25.8.0".\
202+
"SDK Package Version: 25.9.0".\
203203
format(env=sys.platform, pyversion=sys.version)

docs/PdfApi.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Method | HTTP request | Description
212212
[**post_document_image_stamps**](PdfApi.md#post_document_image_stamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
213213
[**post_document_image_stamps_page_specified**](PdfApi.md#post_document_image_stamps_page_specified) | **POST** /pdf/\{name}/stamps/image/pagespecified | Add document image stamps to specified pages.
214214
[**post_document_page_number_stamps**](PdfApi.md#post_document_page_number_stamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
215+
[**post_document_pages_crop**](PdfApi.md#post_document_pages_crop) | **POST** /pdf/\{name}/crop | Crop PDF document pages.
215216
[**post_document_pages_resize**](PdfApi.md#post_document_pages_resize) | **POST** /pdf/\{name}/resize | Rsize PDF document.
216217
[**post_document_pages_rotate**](PdfApi.md#post_document_pages_rotate) | **POST** /pdf/\{name}/rotate | Rotate PDF document.
217218
[**post_document_text_footer**](PdfApi.md#post_document_text_footer) | **POST** /pdf/\{name}/footer/text | Add document text footer.
@@ -5662,6 +5663,33 @@ Name | Type | Description | Notes
56625663

56635664
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
56645665

5666+
# **post_document_pages_crop**
5667+
> AsposeResponse post_document_pages_crop(name, pages, rect, storage=storage, folder=folder, password=password)
5668+
5669+
Crop PDF document pages.
5670+
5671+
### Parameters
5672+
5673+
Name | Type | Description | Notes
5674+
------------- | ------------- | ------------- | -------------
5675+
**name** | **str**| The document name. |
5676+
**pages** | **str**| Comma separated list of pages and page ranges. (Example: 1,3-5,8) |
5677+
**rect** | [**Rectangle**](Rectangle.md)| Rectangle of document area. |
5678+
**storage** | **str**| The document storage. | [optional]
5679+
**folder** | **str**| The document folder. | [optional]
5680+
**password** | **str**| Base64 encoded password. | [optional]
5681+
5682+
### Return type
5683+
5684+
[**AsposeResponse**](AsposeResponse.md)
5685+
5686+
### HTTP request headers
5687+
5688+
- **Content-Type**: application/json
5689+
- **Accept**: application/json
5690+
5691+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
5692+
56655693
# **post_document_pages_resize**
56665694
> AsposeResponse post_document_pages_resize(name, height, width, pages, storage=storage, folder=folder, password=password)
56675695

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from setuptools import setup, find_packages
3333

3434
NAME = "asposepdfcloud"
35-
VERSION = "25.8.0"
35+
VERSION = "25.9.0"
3636
# To install the library, run the following
3737
#
3838
# python setup.py install

test/pdf_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,6 +3462,18 @@ def testPostDocumentPagesResize(self):
34623462
response = self.pdf_api.post_document_pages_resize(file_name, 100, 200, '2-3', **opts)
34633463
self.assertEqual(response.code, 200)
34643464

3465+
def testPostDocumentPagesCrop(self):
3466+
file_name = '4pages.pdf'
3467+
self.uploadFile(file_name)
3468+
opts = {
3469+
"folder" : self.temp_folder
3470+
}
3471+
3472+
rectangle = asposepdfcloud.models.Rectangle(0, 0, 400, 800)
3473+
3474+
response = self.pdf_api.post_document_pages_crop(file_name, '2-3', rectangle, **opts)
3475+
self.assertEqual(response.code, 200)
3476+
34653477
# Fields Tests
34663478

34673479
def testGetField(self):

0 commit comments

Comments
 (0)