TIFF to PDF with Multi-Page Support

IronPDF for Python's ImageToPdfConverter class supports the conversion of TIFF files into PDF documents. When using ImagePdfConverter.ImageToPdf with a TIFF containing multiple frames, it will place each frame of the TIFF on separate pages.

Here is an example of how you can use the ImageToPdfConverter to convert a multi-frame TIFF image into a PDF document:

Explanation of the Code

  1. Importing Modules:

    • PdfDocument and ImageToPdfConverter are imported from the ironpdf package to handle the PDF conversion.
  2. Function convert_tiff_to_pdf(tiff_path: str, pdf_output_path: str):

    • This function takes a TIFF file (via tiff_path) and converts it into a PDF document, saving it to the specified path (pdf_output_path).
  3. ImageToPdfConverter Instance:

    • An instance of ImageToPdfConverter is created to utilize its image_to_pdf method for conversion.
  4. PDF Conversion:

    • The method image_to_pdf(tiff_path) converts the multi-frame TIFF by placing each frame on a separate page in the resulting PDF.
  5. Saving the PDF:
    • The converted PDF is saved using the save method of the PdfDocument class at the specified path.

Replace 'path/to/your/tiff_file.tiff' and 'path/to/output/pdf_document.pdf' with your actual file paths to perform the conversion.