Please follow the steps given below to Export PDF Form data to XML/FDF/XFDF format using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Export PDF to XML using Python.
Please follow the steps given below to Export PDF Form data to XML/FDF/XFDF format using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Export PDF to XML using Python.
This Gist contains code snippets on how to PDF to XML / FDF / XFDF using Aspose.PDF Cloud SDK for Python |
def exportPDFtoFDF(): | |
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-Filled.pdf' | |
# resultant FDF name | |
outputFDF = 'exportedData.fdf' | |
# Export PDF form data to FDF and save output in Cloud storage | |
response = pdf_api.put_export_fields_from_pdf_to_fdf_in_storage(name = input_file, fdf_output_file_path=outputFDF) | |
# print response on console | |
print(response) | |
# print message in console (optional) | |
print('PDF Form data successfully exported to FDF !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |
def exportPDFtoXFDF(): | |
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-Filled.pdf' | |
# resultant XFDF name | |
outputXFDF = 'exportedData.xfdf' | |
# Export PDF form data to XFDF and save output in Cloud storage | |
response = pdf_api.put_export_fields_from_pdf_to_xfdf_in_storage(name = input_file, xml_output_file_path=outputXFDF) | |
# print response on console | |
print(response) | |
# print message in console (optional) | |
print('PDF Form data successfully exported to XFDF !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |
def exportPDFtoXML(): | |
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-Filled.pdf' | |
# resultant XML name | |
outputXML = 'exportedData.xml' | |
# Export PDF form data to XML and save output in Cloud storage | |
response = pdf_api.put_export_fields_from_pdf_to_xml_in_storage(name = input_file, xml_output_file_path=outputXML) | |
# print response on console | |
print(response) | |
# print message in console (optional) | |
print('PDF Form data successfully exported to XML !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |