Please follow the steps given below to convert PDF to TIFF using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Convert PDF to TIFF using Python.
Please follow the steps given below to convert PDF to TIFF using Aspose.PDF Cloud SDK for Python.
For more information, please visit the following blog Convert PDF to TIFF using Python.
This Gist contains code snippets for converting PDF to TIFF using Aspose.PDF Cloud SDK for Python |
def PDFtoTIFF(): | |
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' | |
output_file = 'resultant.tiff' | |
# brightness value for TIFF | |
brightness = 100 | |
# Specify compression for resultant file | |
compressionFactor = 'LZW' | |
# color depth details | |
colorDepth = 'Format8bpp' | |
# margin details for resultant TIFF | |
leftMargin = rightMargin = topMargin = bottomMargin = 2 | |
# Orientation of resultant Image | |
orientation = None | |
# specify to skip blank pages during conversion | |
skipBlankPages = True | |
# width of resultant TIFF | |
width = 2000 | |
# height of resultant TIFF | |
height = 1800 | |
#resolution of resultant TIFF file | |
xResolution = 100 | |
yResolution = 100 | |
# Set the start page for export operation | |
startPageIndex = 1 | |
# Set the count for pages to be exported | |
pageCount = 1 | |
# call the API to convert PDF to TIFF and save resultant to Cloud storage | |
response = pdf_api.put_pdf_in_storage_to_tiff(name = input_file, out_path= output_file, brightness = brightness, | |
compression = compressionFactor,color_depth = colorDepth, left_margin = leftMargin, | |
right_margin = rightMargin, top_margin = topMargin, bottom_margin=bottomMargin, | |
orientation=orientation, skip_blank_pages = skipBlankPages, | |
width = width, height = height, x_resolution = xResolution, | |
y_resolution=yResolution, page_index = startPageIndex, page_count = pageCount) | |
print(response) | |
# print message in console (optional) | |
print('PDF successfully converted to TIFF format !') | |
except ApiException as e: | |
print("Exception while calling PdfApi: {0}".format(e)) | |
print("Code:" + str(e.code)) | |
print("Message:" + e.message) |