Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This Gist contains code snippets regarding the conversion of PDF files to HTML format using Aspose.PDF Cloud SDK for Python
This Gist contains code snippets regarding the conversion of PDF files to HTML format using Aspose.PDF Cloud SDK for Python
# for complete code samples, please visit https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-python
import asposepdfcloud
import asposepdfcloud.models
import asposepdfcloud.api_client
from asposepdfcloud import PdfApi
def pdf2html():
try:
#initialize PdfApi client instance using ClientID and ClientSecret
pdf_api_client = asposepdfcloud.api_client.ApiClient("406b404b2df649611e508bbcfcd2a77f", "88d1cda8-b12c-4a80-b1ad-c85ac483c5c5")
# create PdfApi instance while passing PdfApiClient as argument
pdf_api = PdfApi(pdf_api_client)
# Source PDF document
input_file_name = 'completeWorkbook.pdf'
# name of resultant file
resultant_file_name = 'CodeConversion.zip'
# Call API to perform the conversion
# we have set the output format as zip and document type as xhtml
response = pdf_api.put_pdf_in_storage_to_html(input_file_name,fixed_layout='true', split_into_pages='false', document_type='Xhtml', output_format='zip',out_path=resultant_file_name)
# print message in console (optional)
print('PDF successfully converted to HTML format !')
except ApiException as e:
print("Exception while calling PdfApi: {0}".format(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment