Some test text!

Loading...
Guides

Convert Image to PDF in Python

Many image types can be converted to PDF Documents using PDF.Convert.ToPDF method. For a complete list of formats supported, please refer to Desktop/Server image formats or Web image formats . Some of the formats such as HEIC and PSD formats require an additional plugin called the Advanced Imaging Module. More information about the module and download links can be found here .

# Start with a PDFDoc (the conversion destination)
doc = PDFDoc()

# perform the conversion with no optional parameters
Convert.ToPdf(doc, filename)

For the image formats that are exclusively supported by Advanced Imaging module, the path containing the module should be added using PDFNet.AddResourceSearchPath prior to invoking the PDF.Convert.ToPDF method. The following snippets demonstrate how this can be done.

PDFNet.AddResourceSearchPath('relative/path/to/Lib/')

# Start with a PDFDoc (the conversion destination)
doc = PDFDoc()

# perform the conversion with no optional parameters
Convert.ToPdf(doc, inputFileName)
doc.Save(ouputPath + outputFileName, 0)

Sample

For a complete working sample that uses the Advanced Imaging Module and pdftron.PDF.Convert.ToPdf to convert formats such as HEIC and PSD to PDF, see the AdvancedImagingTest sample . This same code can be used to integrate the module into your application or project.

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use