Skip to content

Instantly share code, notes, and snippets.

@blog-aspose-cloud
Last active March 28, 2023 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blog-aspose-cloud/3f2d7fd4e8e7b6df6912b95052193434 to your computer and use it in GitHub Desktop.
Save blog-aspose-cloud/3f2d7fd4e8e7b6df6912b95052193434 to your computer and use it in GitHub Desktop.
This Gist contains code snippets for converting PDF to MobiXML using Aspose.PDF Cloud SDK for Python
This Gist contains code snippets for converting PDF to MobiXML using Aspose.PDF Cloud SDK for Python.
def PDFtoMobiXML():
try:
#Client credentials
client_secret = "1c9379bb7d701c26cc87e741a29987bb"
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e"
#initialize PdfApi client instance using client credentials
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)
# input PDF file
input_file = 'marketing.pdf'
# resultant file name
output_file = 'converted.zip'
# call the API to convert PDF to MobiXML and save the resultant file as .ZIP archive to Cloud storage
response = pdf_api.put_pdf_in_storage_to_mobi_xml(name = input_file, out_path= output_file)
# print response code in console
print(response)
# print message in console (optional)
print('PDF successfully converted to MobiXML format !')
except ApiException as e:
print("Exception while calling PdfApi: {0}".format(e))
print("Code:" + str(e.code))
print("Message:" + e.message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment