支持多頁的 TIFF 到 PDF

IronPDF for Python 的 ImageToPdfConverter 類別支援將 TIFF 檔案轉換為 PDF 文件。 當使用 ImagePdfConverter.ImageToPdf 處理包含多個訊框的 TIFF 檔案時,它會將 TIFF 檔案的每個影格放置在單獨的頁面上。

以下範例展示如何使用 ImageToPdfConverter 將多幀 TIFF 影像轉換為 PDF 文件:

程式碼說明

1.導​​入模組

  • PdfDocument and ImageToPdfConverter are imported from the ironpdf package to handle the PDF conversion.
  1. 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實例

  • An instance of ImageToPdfConverter is created to utilize its image_to_pdf method for conversion.
  1. 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.

5.保存 PDF 檔

  • The converted PDF is saved using the save method of the PdfDocument class at the specified path.

'path/to/your/tiff_file.tiff''path/to/output/pdf_document.pdf' 替換為您的實際檔案路徑以執行轉換。

學習如何使用 Python 將 PDF 轉換為圖像

準備好開始了嗎?
版本: 2026.3 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想要快速證明?
執行範例 觀看您的 HTML 變成 PDF。