Please follow the steps given below to Import XML to PDF Form using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Import XML Data to PDF Form using Python.
Please follow the steps given below to Import XML to PDF Form using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Import XML Data to PDF Form using Python.
This Gist contains code snippets on how to Import XML / FDF / XFDF data to PDF form using Aspose.PDF Cloud SDK for Python |
def importFDFData(): | |
try: | |
#Client credentials | |
client_secret = "1c9379bb7d701c26cc87e741a29987bb" | |
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e" | |
#initialize PdfApi client instance using client credetials | |
pdf_api_client = asposepdfcloud.api_client.ApiClient(client_secret, client_id) | |
# create PdfApi instance while passing PdfApiClient as argument | |
pdf_api = PdfApi(pdf_api_client) | |
# Source PDF form | |
input_file = 'FormData.pdf' | |
# source FDF with data | |
inputFDF = 'importData.fdf' | |
# call the API to import FDF data in PDF form | |
response = pdf_api.put_import_fields_from_fdf_in_storage(name = input_file, xml_file_path = inputFDF) | |
# print response in console | |
print(response) | |
# print message in console (optional) | |
print('FDF data successfully Imported to PDF Form !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |
def importXFDFdata(): | |
try: | |
#Client credentials | |
client_secret = "1c9379bb7d701c26cc87e741a29987bb" | |
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e" | |
#initialize PdfApi client instance using client credetials | |
pdf_api_client = asposepdfcloud.api_client.ApiClient(client_secret, client_id) | |
# create PdfApi instance while passing PdfApiClient as argument | |
pdf_api = PdfApi(pdf_api_client) | |
# source PDF file | |
input_file = 'FormData.pdf' | |
# input XFDF file | |
inputXFDF = 'exportedData.xfdf' | |
# call API to import XFDF data to PDF form | |
response = pdf_api.put_import_fields_from_xfdf_in_storage(name = input_file, xfdf_file_path = inputXFDF) | |
# print response code in console | |
print(response) | |
# print message in console (optional) | |
print('XFDF Data successfully Imported to PDF Form !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |
def importXMLData(): | |
try: | |
#Client credentials | |
client_secret = "1c9379bb7d701c26cc87e741a29987bb" | |
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e" | |
#initialize PdfApi client instance using client credetials | |
pdf_api_client = asposepdfcloud.api_client.ApiClient(client_secret, client_id) | |
# create PdfApi instance while passing PdfApiClient as argument | |
pdf_api = PdfApi(pdf_api_client) | |
# Source PDF form | |
input_file = 'FormData.pdf' | |
# source XML with data | |
inputXML = 'importData.xml' | |
# call the API to import XML data in PDF form | |
response = pdf_api.put_import_fields_from_xml_in_storage(name = input_file, xml_file_path = inputXML) | |
# print response in console | |
print(response) | |
# print message in console (optional) | |
print('XML Data successfully Imported to PDF Form !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |