This quick how-to article entails how to convert TIFF to PDF in C#. It elaborates the necessary requirements and detailed steps to configure the environment and accomplish the task. For converting TIFF to PDF C# code is used that is also able to customize the output PDF file.
Steps to Convert TIFF to PDF using C#
- Configure the project to use Aspose.Imaging from NuGet Package Manager
- Include the reference to Aspose.Imaging namespace to use API features in the project
- Load the source TIFF file using Image.Load method exposed by Image class
- Create and initialize the PdfOptions object to set the resolution and other settings
- Save the generated PDF on the disk using the Save method
By using the aforementioned steps in C# TIFF to PDF converter is developed using a simple API interface where you may load the source TIFF from the disk or by using Memory Stream and simply convert it to the PDF. You can customize the PDF using the PdfOptions object that allows setting the resolution values for the TIFF images inside the PDF. Finally, using the Save method, the PDF is saved on the disk.
Code to Convert TIFF to PDF in C#
To convert TIFF to PDF C# code is presented where resolution is set for the output PDF file using the horizontal and vertical resolution values. The PdfOptions class contains a lot of other properties including PageSize, MultiPageOptions and PDFCoreOption like Compression, Compliance and JpegQuality settings.
We have learnt, how in C# convert TIFF to PDF can be easily managed in a few lines of code. If you want to learn about compressing image size, refer to the article on how to compress Image size in C#.