Please follow the steps given below to extract attachment details from PDF file using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Download Attachment from PDF using Python.
Please follow the steps given below to extract attachment details from PDF file using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Download Attachment from PDF using Python.
This Gist contains code snippets regarding how to retrieve PDF attachment details using Aspose.PDF Cloud SDK for Python |
def downloadAttachment(): | |
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 image file | |
input_file = 'PdfWithEmbeddedFiles.pdf' | |
# call the API to download first attachment from PDF file | |
response = pdf_api.get_download_document_attachment_by_index(name = input_file, attachment_index=1) | |
print(response) | |
# print message in console (optional) | |
print('PDF Attachment successfully downloaded !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |
def readAttachmentDetails(): | |
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 image file | |
input_file = 'PdfWithEmbeddedFiles.pdf' | |
# call the API to extract attachment details | |
response = pdf_api.get_document_attachments(name = input_file) | |
print(response) | |
# print message in console (optional) | |
print('PDF Attachment details successfully retrieved !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |