diff --git a/README.md b/README.md index f887882..d519f22 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Convert API lets you effortlessly convert file formats and types. This Python package provides a native API client for [Cloudmersive Document Conversion](https://www.cloudmersive.com/convert-api) - API version: v1 -- Package version: 2.1.4 +- Package version: 2.1.5 - Build package: io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -143,6 +143,9 @@ Class | Method | HTTP request | Description *EditDocumentApi* | [**edit_document_xlsx_get_styles**](docs/EditDocumentApi.md#edit_document_xlsx_get_styles) | **POST** /convert/edit/xlsx/get-styles | Get styles from a XLSX worksheet *EditDocumentApi* | [**edit_document_xlsx_get_worksheets**](docs/EditDocumentApi.md#edit_document_xlsx_get_worksheets) | **POST** /convert/edit/xlsx/get-worksheets | Get worksheets from a XLSX *EditDocumentApi* | [**edit_document_xlsx_insert_worksheet**](docs/EditDocumentApi.md#edit_document_xlsx_insert_worksheet) | **POST** /convert/edit/xlsx/insert-worksheet | Insert a new worksheet into an XLSX spreadsheet +*EditPdfApi* | [**edit_pdf_encrypt**](docs/EditPdfApi.md#edit_pdf_encrypt) | **POST** /convert/edit/pdf/encrypt | Encrypt and password-protect a PDF +*EditPdfApi* | [**edit_pdf_set_permissions**](docs/EditPdfApi.md#edit_pdf_set_permissions) | **POST** /convert/edit/pdf/encrypt/set-permissions | Encrypt, password-protect and set restricted permissions on a PDF +*EditPdfApi* | [**edit_pdf_watermark_text**](docs/EditPdfApi.md#edit_pdf_watermark_text) | **POST** /convert/edit/pdf/watermark/text | Add a text watermark to a PDF *MergeDocumentApi* | [**merge_document_docx**](docs/MergeDocumentApi.md#merge_document_docx) | **POST** /convert/merge/docx | Merge Multple Word DOCX Together *MergeDocumentApi* | [**merge_document_pdf**](docs/MergeDocumentApi.md#merge_document_pdf) | **POST** /convert/merge/pdf | Merge Multple PDF Files Together *MergeDocumentApi* | [**merge_document_png**](docs/MergeDocumentApi.md#merge_document_png) | **POST** /convert/merge/png/vertical | Merge Multple PNG Files Together diff --git a/cloudmersive_convert_api_client/__init__.py b/cloudmersive_convert_api_client/__init__.py index bdf600c..4d8c91d 100644 --- a/cloudmersive_convert_api_client/__init__.py +++ b/cloudmersive_convert_api_client/__init__.py @@ -23,6 +23,7 @@ from cloudmersive_convert_api_client.api.convert_template_api import ConvertTemplateApi from cloudmersive_convert_api_client.api.convert_web_api import ConvertWebApi from cloudmersive_convert_api_client.api.edit_document_api import EditDocumentApi +from cloudmersive_convert_api_client.api.edit_pdf_api import EditPdfApi from cloudmersive_convert_api_client.api.merge_document_api import MergeDocumentApi from cloudmersive_convert_api_client.api.split_document_api import SplitDocumentApi from cloudmersive_convert_api_client.api.validate_document_api import ValidateDocumentApi diff --git a/cloudmersive_convert_api_client/api/__init__.py b/cloudmersive_convert_api_client/api/__init__.py index be929df..8fda2a7 100644 --- a/cloudmersive_convert_api_client/api/__init__.py +++ b/cloudmersive_convert_api_client/api/__init__.py @@ -10,6 +10,7 @@ from cloudmersive_convert_api_client.api.convert_template_api import ConvertTemplateApi from cloudmersive_convert_api_client.api.convert_web_api import ConvertWebApi from cloudmersive_convert_api_client.api.edit_document_api import EditDocumentApi +from cloudmersive_convert_api_client.api.edit_pdf_api import EditPdfApi from cloudmersive_convert_api_client.api.merge_document_api import MergeDocumentApi from cloudmersive_convert_api_client.api.split_document_api import SplitDocumentApi from cloudmersive_convert_api_client.api.validate_document_api import ValidateDocumentApi diff --git a/cloudmersive_convert_api_client/api/edit_pdf_api.py b/cloudmersive_convert_api_client/api/edit_pdf_api.py new file mode 100644 index 0000000..071e867 --- /dev/null +++ b/cloudmersive_convert_api_client/api/edit_pdf_api.py @@ -0,0 +1,403 @@ +# coding: utf-8 + +""" + convertapi + + Convert API lets you effortlessly convert file formats and types. # noqa: E501 + + OpenAPI spec version: v1 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from cloudmersive_convert_api_client.api_client import ApiClient + + +class EditPdfApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def edit_pdf_encrypt(self, input_file, **kwargs): # noqa: E501 + """Encrypt and password-protect a PDF # noqa: E501 + + Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_encrypt(input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param file input_file: Input file to perform the operation on. (required) + :param str user_password: Password of a user (reader) of the PDF file + :param str owner_password: Password of a owner (creator/editor) of the PDF file + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.edit_pdf_encrypt_with_http_info(input_file, **kwargs) # noqa: E501 + else: + (data) = self.edit_pdf_encrypt_with_http_info(input_file, **kwargs) # noqa: E501 + return data + + def edit_pdf_encrypt_with_http_info(self, input_file, **kwargs): # noqa: E501 + """Encrypt and password-protect a PDF # noqa: E501 + + Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_encrypt_with_http_info(input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param file input_file: Input file to perform the operation on. (required) + :param str user_password: Password of a user (reader) of the PDF file + :param str owner_password: Password of a owner (creator/editor) of the PDF file + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['input_file', 'user_password', 'owner_password'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method edit_pdf_encrypt" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'input_file' is set + if ('input_file' not in params or + params['input_file'] is None): + raise ValueError("Missing the required parameter `input_file` when calling `edit_pdf_encrypt`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + if 'user_password' in params: + header_params['userPassword'] = params['user_password'] # noqa: E501 + if 'owner_password' in params: + header_params['ownerPassword'] = params['owner_password'] # noqa: E501 + + form_params = [] + local_var_files = {} + if 'input_file' in params: + local_var_files['inputFile'] = params['input_file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['Apikey'] # noqa: E501 + + return self.api_client.call_api( + '/convert/edit/pdf/encrypt', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def edit_pdf_set_permissions(self, owner_password, input_file, **kwargs): # noqa: E501 + """Encrypt, password-protect and set restricted permissions on a PDF # noqa: E501 + + Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_set_permissions(owner_password, input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_password: Password of a owner (creator/editor) of the PDF file (required) (required) + :param file input_file: Input file to perform the operation on. (required) + :param str user_password: Password of a user (reader) of the PDF file (optional) + :param bool allow_printing: Set to false to disable printing through DRM. Default is true. + :param bool allow_document_assembly: Set to false to disable document assembly through DRM. Default is true. + :param bool allow_content_extraction: Set to false to disable copying/extracting content out of the PDF through DRM. Default is true. + :param bool allow_form_filling: Set to false to disable filling out form fields in the PDF through DRM. Default is true. + :param bool allow_editing: Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true. + :param bool allow_annotations: Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true. + :param bool allow_degraded_printing: Set to false to disable degraded printing of the PDF through DRM. Default is true. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.edit_pdf_set_permissions_with_http_info(owner_password, input_file, **kwargs) # noqa: E501 + else: + (data) = self.edit_pdf_set_permissions_with_http_info(owner_password, input_file, **kwargs) # noqa: E501 + return data + + def edit_pdf_set_permissions_with_http_info(self, owner_password, input_file, **kwargs): # noqa: E501 + """Encrypt, password-protect and set restricted permissions on a PDF # noqa: E501 + + Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_set_permissions_with_http_info(owner_password, input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_password: Password of a owner (creator/editor) of the PDF file (required) (required) + :param file input_file: Input file to perform the operation on. (required) + :param str user_password: Password of a user (reader) of the PDF file (optional) + :param bool allow_printing: Set to false to disable printing through DRM. Default is true. + :param bool allow_document_assembly: Set to false to disable document assembly through DRM. Default is true. + :param bool allow_content_extraction: Set to false to disable copying/extracting content out of the PDF through DRM. Default is true. + :param bool allow_form_filling: Set to false to disable filling out form fields in the PDF through DRM. Default is true. + :param bool allow_editing: Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true. + :param bool allow_annotations: Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true. + :param bool allow_degraded_printing: Set to false to disable degraded printing of the PDF through DRM. Default is true. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_password', 'input_file', 'user_password', 'allow_printing', 'allow_document_assembly', 'allow_content_extraction', 'allow_form_filling', 'allow_editing', 'allow_annotations', 'allow_degraded_printing'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method edit_pdf_set_permissions" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_password' is set + if ('owner_password' not in params or + params['owner_password'] is None): + raise ValueError("Missing the required parameter `owner_password` when calling `edit_pdf_set_permissions`") # noqa: E501 + # verify the required parameter 'input_file' is set + if ('input_file' not in params or + params['input_file'] is None): + raise ValueError("Missing the required parameter `input_file` when calling `edit_pdf_set_permissions`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + if 'owner_password' in params: + header_params['ownerPassword'] = params['owner_password'] # noqa: E501 + if 'user_password' in params: + header_params['userPassword'] = params['user_password'] # noqa: E501 + if 'allow_printing' in params: + header_params['allowPrinting'] = params['allow_printing'] # noqa: E501 + if 'allow_document_assembly' in params: + header_params['allowDocumentAssembly'] = params['allow_document_assembly'] # noqa: E501 + if 'allow_content_extraction' in params: + header_params['allowContentExtraction'] = params['allow_content_extraction'] # noqa: E501 + if 'allow_form_filling' in params: + header_params['allowFormFilling'] = params['allow_form_filling'] # noqa: E501 + if 'allow_editing' in params: + header_params['allowEditing'] = params['allow_editing'] # noqa: E501 + if 'allow_annotations' in params: + header_params['allowAnnotations'] = params['allow_annotations'] # noqa: E501 + if 'allow_degraded_printing' in params: + header_params['allowDegradedPrinting'] = params['allow_degraded_printing'] # noqa: E501 + + form_params = [] + local_var_files = {} + if 'input_file' in params: + local_var_files['inputFile'] = params['input_file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['Apikey'] # noqa: E501 + + return self.api_client.call_api( + '/convert/edit/pdf/encrypt/set-permissions', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def edit_pdf_watermark_text(self, watermark_text, input_file, **kwargs): # noqa: E501 + """Add a text watermark to a PDF # noqa: E501 + + Adds a text watermark to a PDF # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_watermark_text(watermark_text, input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str watermark_text: Watermark text to add to the PDF (required) (required) + :param file input_file: Input file to perform the operation on. (required) + :param str font_name: Font Family Name for the watermark text; default is Times New Roman + :param float font_size: Font Size in points of the text; default is 150 + :param str font_color: Font color in hexadecimal or HTML color name; default is Red + :param float font_transparency: Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5 + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.edit_pdf_watermark_text_with_http_info(watermark_text, input_file, **kwargs) # noqa: E501 + else: + (data) = self.edit_pdf_watermark_text_with_http_info(watermark_text, input_file, **kwargs) # noqa: E501 + return data + + def edit_pdf_watermark_text_with_http_info(self, watermark_text, input_file, **kwargs): # noqa: E501 + """Add a text watermark to a PDF # noqa: E501 + + Adds a text watermark to a PDF # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.edit_pdf_watermark_text_with_http_info(watermark_text, input_file, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str watermark_text: Watermark text to add to the PDF (required) (required) + :param file input_file: Input file to perform the operation on. (required) + :param str font_name: Font Family Name for the watermark text; default is Times New Roman + :param float font_size: Font Size in points of the text; default is 150 + :param str font_color: Font color in hexadecimal or HTML color name; default is Red + :param float font_transparency: Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5 + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['watermark_text', 'input_file', 'font_name', 'font_size', 'font_color', 'font_transparency'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method edit_pdf_watermark_text" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'watermark_text' is set + if ('watermark_text' not in params or + params['watermark_text'] is None): + raise ValueError("Missing the required parameter `watermark_text` when calling `edit_pdf_watermark_text`") # noqa: E501 + # verify the required parameter 'input_file' is set + if ('input_file' not in params or + params['input_file'] is None): + raise ValueError("Missing the required parameter `input_file` when calling `edit_pdf_watermark_text`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + if 'watermark_text' in params: + header_params['watermarkText'] = params['watermark_text'] # noqa: E501 + if 'font_name' in params: + header_params['fontName'] = params['font_name'] # noqa: E501 + if 'font_size' in params: + header_params['fontSize'] = params['font_size'] # noqa: E501 + if 'font_color' in params: + header_params['fontColor'] = params['font_color'] # noqa: E501 + if 'font_transparency' in params: + header_params['fontTransparency'] = params['font_transparency'] # noqa: E501 + + form_params = [] + local_var_files = {} + if 'input_file' in params: + local_var_files['inputFile'] = params['input_file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['Apikey'] # noqa: E501 + + return self.api_client.call_api( + '/convert/edit/pdf/watermark/text', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/cloudmersive_convert_api_client/api_client.py b/cloudmersive_convert_api_client/api_client.py index c450791..6b679b4 100644 --- a/cloudmersive_convert_api_client/api_client.py +++ b/cloudmersive_convert_api_client/api_client.py @@ -74,7 +74,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/2.1.4/python' + self.user_agent = 'Swagger-Codegen/2.1.5/python' def __del__(self): if self._pool is not None: diff --git a/cloudmersive_convert_api_client/configuration.py b/cloudmersive_convert_api_client/configuration.py index 9fff73d..d978cda 100644 --- a/cloudmersive_convert_api_client/configuration.py +++ b/cloudmersive_convert_api_client/configuration.py @@ -240,5 +240,5 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: v1\n"\ - "SDK Package Version: 2.1.4".\ + "SDK Package Version: 2.1.5".\ format(env=sys.platform, pyversion=sys.version) diff --git a/docs/EditPdfApi.md b/docs/EditPdfApi.md new file mode 100644 index 0000000..cdee589 --- /dev/null +++ b/docs/EditPdfApi.md @@ -0,0 +1,205 @@ +# cloudmersive_convert_api_client.EditPdfApi + +All URIs are relative to *https://api.cloudmersive.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**edit_pdf_encrypt**](EditPdfApi.md#edit_pdf_encrypt) | **POST** /convert/edit/pdf/encrypt | Encrypt and password-protect a PDF +[**edit_pdf_set_permissions**](EditPdfApi.md#edit_pdf_set_permissions) | **POST** /convert/edit/pdf/encrypt/set-permissions | Encrypt, password-protect and set restricted permissions on a PDF +[**edit_pdf_watermark_text**](EditPdfApi.md#edit_pdf_watermark_text) | **POST** /convert/edit/pdf/watermark/text | Add a text watermark to a PDF + + +# **edit_pdf_encrypt** +> str edit_pdf_encrypt(input_file, user_password=user_password, owner_password=owner_password) + +Encrypt and password-protect a PDF + +Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password. + +### Example +```python +from __future__ import print_function +import time +import cloudmersive_convert_api_client +from cloudmersive_convert_api_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: Apikey +configuration = cloudmersive_convert_api_client.Configuration() +configuration.api_key['Apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['Apikey'] = 'Bearer' + +# create an instance of the API class +api_instance = cloudmersive_convert_api_client.EditPdfApi(cloudmersive_convert_api_client.ApiClient(configuration)) +input_file = '/path/to/file.txt' # file | Input file to perform the operation on. +user_password = 'user_password_example' # str | Password of a user (reader) of the PDF file (optional) +owner_password = 'owner_password_example' # str | Password of a owner (creator/editor) of the PDF file (optional) + +try: + # Encrypt and password-protect a PDF + api_response = api_instance.edit_pdf_encrypt(input_file, user_password=user_password, owner_password=owner_password) + pprint(api_response) +except ApiException as e: + print("Exception when calling EditPdfApi->edit_pdf_encrypt: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **input_file** | **file**| Input file to perform the operation on. | + **user_password** | **str**| Password of a user (reader) of the PDF file | [optional] + **owner_password** | **str**| Password of a owner (creator/editor) of the PDF file | [optional] + +### Return type + +**str** + +### Authorization + +[Apikey](../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/octet-stream + +[[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) + +# **edit_pdf_set_permissions** +> str edit_pdf_set_permissions(owner_password, input_file, user_password=user_password, allow_printing=allow_printing, allow_document_assembly=allow_document_assembly, allow_content_extraction=allow_content_extraction, allow_form_filling=allow_form_filling, allow_editing=allow_editing, allow_annotations=allow_annotations, allow_degraded_printing=allow_degraded_printing) + +Encrypt, password-protect and set restricted permissions on a PDF + +Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM). + +### Example +```python +from __future__ import print_function +import time +import cloudmersive_convert_api_client +from cloudmersive_convert_api_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: Apikey +configuration = cloudmersive_convert_api_client.Configuration() +configuration.api_key['Apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['Apikey'] = 'Bearer' + +# create an instance of the API class +api_instance = cloudmersive_convert_api_client.EditPdfApi(cloudmersive_convert_api_client.ApiClient(configuration)) +owner_password = 'owner_password_example' # str | Password of a owner (creator/editor) of the PDF file (required) +input_file = '/path/to/file.txt' # file | Input file to perform the operation on. +user_password = 'user_password_example' # str | Password of a user (reader) of the PDF file (optional) (optional) +allow_printing = true # bool | Set to false to disable printing through DRM. Default is true. (optional) +allow_document_assembly = true # bool | Set to false to disable document assembly through DRM. Default is true. (optional) +allow_content_extraction = true # bool | Set to false to disable copying/extracting content out of the PDF through DRM. Default is true. (optional) +allow_form_filling = true # bool | Set to false to disable filling out form fields in the PDF through DRM. Default is true. (optional) +allow_editing = true # bool | Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true. (optional) +allow_annotations = true # bool | Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true. (optional) +allow_degraded_printing = true # bool | Set to false to disable degraded printing of the PDF through DRM. Default is true. (optional) + +try: + # Encrypt, password-protect and set restricted permissions on a PDF + api_response = api_instance.edit_pdf_set_permissions(owner_password, input_file, user_password=user_password, allow_printing=allow_printing, allow_document_assembly=allow_document_assembly, allow_content_extraction=allow_content_extraction, allow_form_filling=allow_form_filling, allow_editing=allow_editing, allow_annotations=allow_annotations, allow_degraded_printing=allow_degraded_printing) + pprint(api_response) +except ApiException as e: + print("Exception when calling EditPdfApi->edit_pdf_set_permissions: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **owner_password** | **str**| Password of a owner (creator/editor) of the PDF file (required) | + **input_file** | **file**| Input file to perform the operation on. | + **user_password** | **str**| Password of a user (reader) of the PDF file (optional) | [optional] + **allow_printing** | **bool**| Set to false to disable printing through DRM. Default is true. | [optional] + **allow_document_assembly** | **bool**| Set to false to disable document assembly through DRM. Default is true. | [optional] + **allow_content_extraction** | **bool**| Set to false to disable copying/extracting content out of the PDF through DRM. Default is true. | [optional] + **allow_form_filling** | **bool**| Set to false to disable filling out form fields in the PDF through DRM. Default is true. | [optional] + **allow_editing** | **bool**| Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true. | [optional] + **allow_annotations** | **bool**| Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true. | [optional] + **allow_degraded_printing** | **bool**| Set to false to disable degraded printing of the PDF through DRM. Default is true. | [optional] + +### Return type + +**str** + +### Authorization + +[Apikey](../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/octet-stream + +[[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) + +# **edit_pdf_watermark_text** +> str edit_pdf_watermark_text(watermark_text, input_file, font_name=font_name, font_size=font_size, font_color=font_color, font_transparency=font_transparency) + +Add a text watermark to a PDF + +Adds a text watermark to a PDF + +### Example +```python +from __future__ import print_function +import time +import cloudmersive_convert_api_client +from cloudmersive_convert_api_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: Apikey +configuration = cloudmersive_convert_api_client.Configuration() +configuration.api_key['Apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['Apikey'] = 'Bearer' + +# create an instance of the API class +api_instance = cloudmersive_convert_api_client.EditPdfApi(cloudmersive_convert_api_client.ApiClient(configuration)) +watermark_text = 'watermark_text_example' # str | Watermark text to add to the PDF (required) +input_file = '/path/to/file.txt' # file | Input file to perform the operation on. +font_name = 'font_name_example' # str | Font Family Name for the watermark text; default is Times New Roman (optional) +font_size = 8.14 # float | Font Size in points of the text; default is 150 (optional) +font_color = 'font_color_example' # str | Font color in hexadecimal or HTML color name; default is Red (optional) +font_transparency = 8.14 # float | Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5 (optional) + +try: + # Add a text watermark to a PDF + api_response = api_instance.edit_pdf_watermark_text(watermark_text, input_file, font_name=font_name, font_size=font_size, font_color=font_color, font_transparency=font_transparency) + pprint(api_response) +except ApiException as e: + print("Exception when calling EditPdfApi->edit_pdf_watermark_text: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **watermark_text** | **str**| Watermark text to add to the PDF (required) | + **input_file** | **file**| Input file to perform the operation on. | + **font_name** | **str**| Font Family Name for the watermark text; default is Times New Roman | [optional] + **font_size** | **float**| Font Size in points of the text; default is 150 | [optional] + **font_color** | **str**| Font color in hexadecimal or HTML color name; default is Red | [optional] + **font_transparency** | **float**| Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5 | [optional] + +### Return type + +**str** + +### Authorization + +[Apikey](../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/octet-stream + +[[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) + diff --git a/packageconfig.json b/packageconfig.json index 5dddfa0..059333a 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,6 +1,6 @@ { "projectName" : "cloudmersive_convert_api_client", "packageName" : "cloudmersive_convert_api_client", - "packageVersion": "2.1.4", + "packageVersion": "2.1.5", "packageUrl": "https://www.cloudmersive.com/convert-api" } \ No newline at end of file diff --git a/setup.py b/setup.py index 929ecf6..e360cc6 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "cloudmersive_convert_api_client" -VERSION = "2.1.4" +VERSION = "2.1.5" # To install the library, run the following # # python setup.py install diff --git a/test/test_edit_pdf_api.py b/test/test_edit_pdf_api.py new file mode 100644 index 0000000..1050815 --- /dev/null +++ b/test/test_edit_pdf_api.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + convertapi + + Convert API lets you effortlessly convert file formats and types. # noqa: E501 + + OpenAPI spec version: v1 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import cloudmersive_convert_api_client +from cloudmersive_convert_api_client.api.edit_pdf_api import EditPdfApi # noqa: E501 +from cloudmersive_convert_api_client.rest import ApiException + + +class TestEditPdfApi(unittest.TestCase): + """EditPdfApi unit test stubs""" + + def setUp(self): + self.api = cloudmersive_convert_api_client.api.edit_pdf_api.EditPdfApi() # noqa: E501 + + def tearDown(self): + pass + + def test_edit_pdf_encrypt(self): + """Test case for edit_pdf_encrypt + + Encrypt and password-protect a PDF # noqa: E501 + """ + pass + + def test_edit_pdf_set_permissions(self): + """Test case for edit_pdf_set_permissions + + Encrypt, password-protect and set restricted permissions on a PDF # noqa: E501 + """ + pass + + def test_edit_pdf_watermark_text(self): + """Test case for edit_pdf_watermark_text + + Add a text watermark to a PDF # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main()