TIFF do PDF z obsluga wielu stron
IronPDF for Python's ImageToPdfConverter klasa wspiera konwersję plików TIFF na dokumenty PDF. Podczas używania ImagePdfConverter.ImageToPdf z TIFF zawierającym wiele klatek, każda klatka TIFF zostanie umieszczona na osobnej stronie.
Oto przykład, jak można użyć ImageToPdfConverter do konwersji obrazu TIFF z wieloma klatkami do dokumentu PDF:
Wyjaśnienie kodu
Importowanie modułów:
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
Przykład użycia ImageToPdfConverter:
- An instance of
ImageToPdfConverteris created to utilize itsimage_to_pdfmethod for conversion.
- An instance of
Konwersja plików PDF:
- 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
- Zapisywanie pliku PDF:
- The converted PDF is saved using the
savemethod of thePdfDocumentclass at the specified path.
- The converted PDF is saved using the
Zastąp 'path/to/your/tiff_file.tiff' i 'path/to/output/pdf_document.pdf' swoimi rzeczywistymi ścieżkami plików, aby przeprowadzić konwersję.
Dowiedz się, jak konwertować pliki PDF na obrazy za pomocą języka Python






