TIFF zu PDF mit Unterstützung für mehrere Seiten
Die Klasse ImageToPdfConverter von IronPDF for Python unterstützt die Konvertierung von TIFF-Dateien in PDF-Dokumente. Bei Verwendung von ImagePdfConverter.ImageToPdf mit einer TIFF-Datei, die mehrere Einzelbilder enthält, werden die Einzelbilder der TIFF-Datei auf separaten Seiten platziert.
Hier ist ein Beispiel dafür, wie Sie mit dem Code ImageToPdfConverter ein TIFF-Bild mit mehreren Einzelbildern in ein PDF-Dokument konvertieren können:
Erklärung des Codes
-
Module importieren:
PdfDocumentandImageToPdfConverterare imported from theironpdfpackage to handle the PDF conversion.
-
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).
- This function takes a TIFF file (via
-
ImageToPdfConverter Instanz:
- An instance of
ImageToPdfConverteris created to utilize itsimage_to_pdfmethod for conversion.
- An instance of
-
PDF-Umwandlung:
- The method
image_to_pdf(tiff_path)converts the multi-frame TIFF by placing each frame on a separate page in the resulting PDF.
- The method
- PDF speichern:
- The converted PDF is saved using the
savemethod of thePdfDocumentclass at the specified path.
- The converted PDF is saved using the
Ersetzen Sie 'path/to/your/tiff_file.tiff' und 'path/to/output/pdf_document.pdf' durch Ihre tatsächlichen Dateipfade, um die Konvertierung durchzuführen.

