マルチページサポート付きTIFFをPDFに変換
IronPDF for Python の ImageToPdfConverter クラスは、TIFF ファイルをPDF ドキュメントに変換することをサポートします。 複数フレームを持つ TIFF を ImagePdfConverter.ImageToPdf で使用すると、TIFF の各フレームは別々のページに配置されます。
以下は、マルチフレームの TIFF イメージを PDF ドキュメントに変換するために ImageToPdfConverter を使用する方法の例です。
コードの説明
モジュールのインポート:
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 インスタンス:
- An instance of
ImageToPdfConverteris created to utilize itsimage_to_pdfmethod for conversion.
- An instance of
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
- PDF の保存:
- The converted PDF is saved using the
savemethod of thePdfDocumentclass at the specified path.
- The converted PDF is saved using the
'path/to/your/tiff_file.tiff' と 'path/to/output/pdf_document.pdf' を実際のファイルパスに置き換えて変換を実行します。






