pdftools_sdk.image2_pdf.converter
Classes
The class to convert one or more images to a PDF document |
- class pdftools_sdk.image2_pdf.converter.Converter[source]
Bases:
_NativeObject
The class to convert one or more images to a PDF document
- convert(image: Document, out_stream: IOBase, profile: Profile, out_options: OutputOptions | None = None) Document [source]
Convert an image to a PDF document
- Parameters:
image (pdftools_sdk.image.document.Document) – The input image document containing one or more pages.
outStream (io.IOBase) – The stream to which the PDF is written.
profile (pdftools_sdk.image2_pdf.profiles.profile.Profile) –
The profile defines the properties of the output document and how the images are placed onto the pages.
For details, see
pdftools_sdk.image2_pdf.profiles.profile.Profile
.outOptions (Optional[pdftools_sdk.pdf.output_options.OutputOptions]) – The PDF output options, e.g. to encrypt the output document.
- Returns:
The resulting output PDF which can be used as a new input for further processing.
Note that, this object must be disposed before the output stream object (method argument outStream).
- Return type:
- Raises:
pdftools_sdk.license_error.LicenseError – The license is invalid.
OSError – Writing to the output PDF failed.
pdftools_sdk.corrupt_error.CorruptError – The input image document is corrupt and cannot be read.
pdftools_sdk.generic_error.GenericError – An unexpected failure occurred.
pdftools_sdk.processing_error.ProcessingError – The conversion failed.
ValueError – The profile specifies invalid options.
ValueError – The outOptions specifies document encryption and the profile PDF/A conformance, which is not allowed.
- convert_multiple(images: DocumentList, out_stream: IOBase, profile: Profile, out_options: OutputOptions | None = None) Document [source]
Convert a list of images to a PDF document
- Parameters:
images (pdftools_sdk.image.document_list.DocumentList) – The input image document list, each image containing one or more pages.
outStream (io.IOBase) – The stream to which the PDF is written.
profile (pdftools_sdk.image2_pdf.profiles.profile.Profile) –
The profile defines the properties of the output document and how the images are placed onto the pages.
For details, see
pdftools_sdk.image2_pdf.profiles.profile.Profile
.outOptions (Optional[pdftools_sdk.pdf.output_options.OutputOptions]) – The PDF output options, e.g. to encrypt the output document.
- Returns:
The resulting output PDF which can be used as a new input for further processing.
Note that, this object must be disposed before the output stream object (method argument outStream).
- Return type:
- Raises:
pdftools_sdk.license_error.LicenseError – The license is invalid.
OSError – Writing to the output PDF failed.
pdftools_sdk.corrupt_error.CorruptError – An input image document is corrupt and cannot be read.
pdftools_sdk.generic_error.GenericError – An unexpected failure occurred.
pdftools_sdk.processing_error.ProcessingError – The conversion failed.
ValueError – The profile specifies invalid options.
ValueError – The outOptions specifies document encryption and the profile PDF/A conformance, which is not allowed.