Skip to content

Commit 0dcadd1

Browse files
update to 24.5
1 parent 1e7dfe0 commit 0dcadd1

File tree

7 files changed

+168
-8
lines changed

7 files changed

+168
-8
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ 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.4
34-
- Convert PDF to optimized Text.
35-
- Convert PDF to EXCEL without Cloud Storage.
33+
## Enhancements in Version 24.5
3634
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3735

36+
## Bugs fixed in Version 24.5
37+
- Aspose.PDF Cloud Service Throws Bad Gateway Error intermittently.
38+
3839
## Requirements.
3940
Python 2.7 and 3.4+
4041

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'] = '24.4.0'
86+
self.default_headers['x-aspose-client-version'] = '24.5.0'
8787

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

asposepdfcloud/apis/pdf_api.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24553,6 +24553,135 @@ def post_flatten_document_with_http_info(self, name, **kwargs):
2455324553
_request_timeout=params.get('_request_timeout'),
2455424554
collection_formats=collection_formats)
2455524555

24556+
def post_html_to_pdf(self, **kwargs):
24557+
"""
24558+
Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
24559+
This method makes a synchronous HTTP request by default. To make an
24560+
asynchronous HTTP request, please define a `callback` function
24561+
to be invoked when receiving the response.
24562+
>>> def callback_function(response):
24563+
>>> pprint(response)
24564+
>>>
24565+
>>> thread = api.post_html_to_pdf(callback=callback_function)
24566+
24567+
:param callback function: The callback function
24568+
for asynchronous request. (optional)
24569+
:param str html_file_name: Name of HTML file in ZIP.
24570+
:param float height: Page height
24571+
:param float width: Page width
24572+
:param bool is_landscape: Is page landscaped
24573+
:param float margin_left: Page margin left
24574+
:param float margin_bottom: Page margin bottom
24575+
:param float margin_right: Page margin right
24576+
:param float margin_top: Page margin top
24577+
:return: file
24578+
If the method is called asynchronously,
24579+
returns the request thread.
24580+
"""
24581+
kwargs['_return_http_data_only'] = True
24582+
if kwargs.get('callback'):
24583+
return self.post_html_to_pdf_with_http_info(**kwargs)
24584+
else:
24585+
(data) = self.post_html_to_pdf_with_http_info(**kwargs)
24586+
return data
24587+
24588+
def post_html_to_pdf_with_http_info(self, **kwargs):
24589+
"""
24590+
Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
24591+
This method makes a synchronous HTTP request by default. To make an
24592+
asynchronous HTTP request, please define a `callback` function
24593+
to be invoked when receiving the response.
24594+
>>> def callback_function(response):
24595+
>>> pprint(response)
24596+
>>>
24597+
>>> thread = api.post_html_to_pdf_with_http_info(callback=callback_function)
24598+
24599+
:param callback function: The callback function
24600+
for asynchronous request. (optional)
24601+
:param str html_file_name: Name of HTML file in ZIP.
24602+
:param float height: Page height
24603+
:param float width: Page width
24604+
:param bool is_landscape: Is page landscaped
24605+
:param float margin_left: Page margin left
24606+
:param float margin_bottom: Page margin bottom
24607+
:param float margin_right: Page margin right
24608+
:param float margin_top: Page margin top
24609+
:return: file
24610+
If the method is called asynchronously,
24611+
returns the request thread.
24612+
"""
24613+
24614+
all_params = ['html_file_name', 'height', 'width', 'is_landscape', 'margin_left', 'margin_bottom', 'margin_right', 'margin_top']
24615+
all_params.append('callback')
24616+
all_params.append('_return_http_data_only')
24617+
all_params.append('_preload_content')
24618+
all_params.append('_request_timeout')
24619+
24620+
params = locals()
24621+
for key, val in iteritems(params['kwargs']):
24622+
if key not in all_params:
24623+
raise TypeError(
24624+
"Got an unexpected keyword argument '%s'"
24625+
" to method post_html_to_pdf" % key
24626+
)
24627+
params[key] = val
24628+
del params['kwargs']
24629+
24630+
24631+
collection_formats = {}
24632+
24633+
path_params = {}
24634+
24635+
query_params = []
24636+
if 'html_file_name' in params:
24637+
query_params.append(('htmlFileName', params['html_file_name']))
24638+
if 'height' in params:
24639+
query_params.append(('height', params['height']))
24640+
if 'width' in params:
24641+
query_params.append(('width', params['width']))
24642+
if 'is_landscape' in params:
24643+
query_params.append(('isLandscape', params['is_landscape']))
24644+
if 'margin_left' in params:
24645+
query_params.append(('marginLeft', params['margin_left']))
24646+
if 'margin_bottom' in params:
24647+
query_params.append(('marginBottom', params['margin_bottom']))
24648+
if 'margin_right' in params:
24649+
query_params.append(('marginRight', params['margin_right']))
24650+
if 'margin_top' in params:
24651+
query_params.append(('marginTop', params['margin_top']))
24652+
24653+
header_params = {}
24654+
24655+
form_params = []
24656+
local_var_files = {}
24657+
24658+
body_params = None
24659+
# HTTP header `Accept`
24660+
header_params['Accept'] = self.api_client.\
24661+
select_header_accept(['multipart/form-data'])
24662+
24663+
# HTTP header `Content-Type`
24664+
header_params['Content-Type'] = self.api_client.\
24665+
select_header_content_type(['multipart/form-data'])
24666+
24667+
# Authentication setting
24668+
auth_settings = ['JWT']
24669+
24670+
return self.api_client.call_api('/pdf/create/html', 'POST',
24671+
path_params,
24672+
query_params,
24673+
header_params,
24674+
body=body_params,
24675+
post_params=form_params,
24676+
files=local_var_files,
24677+
response_type='file',
24678+
auth_settings=auth_settings,
24679+
callback=params.get('callback'),
24680+
_return_http_data_only=params.get('_return_http_data_only'),
24681+
_preload_content=params.get('_preload_content', True),
24682+
_request_timeout=params.get('_request_timeout'),
24683+
collection_formats=collection_formats)
24684+
2455624685
def post_import_fields_from_fdf(self, name, **kwargs):
2455724686
"""
2455824687
Update fields from FDF file in request.

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: 24.4.0".\
202+
"SDK Package Version: 24.5.0".\
203203
format(env=sys.platform, pyversion=sys.version)

docs/PdfApi.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ Method | HTTP request | Description
209209
[**post_document_text_replace**](PdfApi.md#post_document_text_replace) | **POST** /pdf/\{name}/text/replace | Document's replace text method.
210210
[**post_encrypt_document_in_storage**](PdfApi.md#post_encrypt_document_in_storage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
211211
[**post_flatten_document**](PdfApi.md#post_flatten_document) | **POST** /pdf/\{name}/flatten | Flatten the document.
212+
[**post_html_to_pdf**](PdfApi.md#post_html_to_pdf) | **POST** /pdf/create/html | Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
212213
[**post_import_fields_from_fdf**](PdfApi.md#post_import_fields_from_fdf) | **POST** /pdf/\{name}/import/fdf | Update fields from FDF file in request.
213214
[**post_import_fields_from_xfdf**](PdfApi.md#post_import_fields_from_xfdf) | **POST** /pdf/\{name}/import/xfdf | Update fields from XFDF file in request.
214215
[**post_import_fields_from_xml**](PdfApi.md#post_import_fields_from_xml) | **POST** /pdf/\{name}/import/xml | Update fields from XML file in request.
@@ -5571,6 +5572,35 @@ Name | Type | Description | Notes
55715572

55725573
[[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)
55735574

5575+
# **post_html_to_pdf**
5576+
> file post_html_to_pdf(html_file_name=html_file_name, height=height, width=width, is_landscape=is_landscape, margin_left=margin_left, margin_bottom=margin_bottom, margin_right=margin_right, margin_top=margin_top)
5577+
5578+
Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
5579+
5580+
### Parameters
5581+
5582+
Name | Type | Description | Notes
5583+
------------- | ------------- | ------------- | -------------
5584+
**html_file_name** | **str**| Name of HTML file in ZIP. | [optional]
5585+
**height** | **float**| Page height | [optional]
5586+
**width** | **float**| Page width | [optional]
5587+
**is_landscape** | **bool**| Is page landscaped | [optional]
5588+
**margin_left** | **float**| Page margin left | [optional]
5589+
**margin_bottom** | **float**| Page margin bottom | [optional]
5590+
**margin_right** | **float**| Page margin right | [optional]
5591+
**margin_top** | **float**| Page margin top | [optional]
5592+
5593+
### Return type
5594+
5595+
**file**
5596+
5597+
### HTTP request headers
5598+
5599+
- **Content-Type**: multipart/form-data
5600+
- **Accept**: multipart/form-data
5601+
5602+
[[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)
5603+
55745604
# **post_import_fields_from_fdf**
55755605
> AsposeResponse post_import_fields_from_fdf(name, storage=storage, folder=folder, fdf_data=fdf_data)
55765606

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 = "24.4.0"
35+
VERSION = "24.5.0"
3636
# To install the library, run the following
3737
#
3838
# python setup.py install

test/pdf_tests.py renamed to test/pdf_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
from __future__ import absolute_import
32-
from asposepdfcloud.models import text_style
32+
# from asposepdfcloud.models import text_style
3333

3434
import os
3535
import sys
@@ -39,7 +39,7 @@
3939

4040
import asposepdfcloud
4141
from asposepdfcloud.apis.pdf_api import PdfApi
42-
from asposepdfcloud.rest import ApiException
42+
# from asposepdfcloud.rest import ApiException
4343
#from asposepdfcloud.models.annotations_ import AnnotationInfoResponse
4444

4545

0 commit comments

Comments
 (0)