Follow this article to convert TIFF to PDF using Python to make it more accessible, compressing its size, and ensuring consistent formatting across the devices. You will learn to format the output PDF file as per the requirements by using the PdfOptions class object. This process of converting TIFF image to PDF using Python helps in converting multiple TIFF images to a single PDF that is ideal for sharing, printing, and archiving.
Steps to Change TIFF to PDF using Python
- Setup the environment by installing Aspose.Imaging for Python via .NET for creating PDF from a TIFF file
- Import all the required modules, including pycore, Image, ResolutionSetting, TiffImage, and PdfOptions
- Load the source TIFF image using the load() method
- Convert the image type to TIFF using the as_of() method
- Create a PDF save options object and set the output PDF resolution
- Save the loaded TIFF as a PDF using the specified PDF options
These steps define the process to change a file from TIFF format to PDF using Python. Load the source TIFF file as an image and change its type from Image to TIFF for using TIFF-related features in the API. Finally, declare the PdfOptions, set resolution, and call the save() method with defined PDF options to convert the TIFF file to PDF.
Code to Convert TIFF Image to PDF using Python
This sample code has demonstrated the process of transforming a TIFF file to PDF using Python. You may set the flag to keep the metadata on export, set page size, and vector rasterization options, to list a few. The resolution settings include both the horizontal and vertical resolutions.
This article has taught us the process of changing a TIF file to PDF. To blur an image, refer to the article on Blur Image in Python.