pdftools_sdk.pdf2_image.converter
Classes
The class to convert a PDF document to a rasterized image |
- class pdftools_sdk.pdf2_image.converter.Converter[source]
Bases:
_NativeObject
The class to convert a PDF document to a rasterized image
- convert_document(in_doc: Document, out_stream: IOBase, profile: Profile) MultiPageDocument [source]
Convert all pages of a PDF document to a rasterized image
- Parameters:
inDoc (pdftools_sdk.pdf.document.Document) – The input PDF document
outStream (io.IOBase) – The stream to which the rasterized image is written.
profile (pdftools_sdk.pdf2_image.profiles.profile.Profile) –
The profile defines how the PDF pages are rendered and what type of output image is used. Note that the profile’s image options must support multi-page images (TIFF). For other profiles, the method
pdftools_sdk.pdf2_image.converter.Converter.convert_page()
should be used.For details, see
pdftools_sdk.pdf2_image.profiles.profile.Profile
.
- Returns:
The output image document. The object can be used as 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 image failed.
pdftools_sdk.unsupported_feature_error.UnsupportedFeatureError – The input PDF is a PDF collection (Portfolio) that has no cover pages.
pdftools_sdk.unsupported_feature_error.UnsupportedFeatureError – The input PDF contains unrendered XFA form fields. See
pdftools_sdk.pdf.document.Document.xfa
for more information on how to detect and handle XFA documents.pdftools_sdk.generic_error.GenericError – An unexpected failure occurred.
ValueError – The profile does not support multi-page output.
pdftools_sdk.processing_error.ProcessingError – The processing has failed.
StateError – Internal error has occured.
- convert_page(in_doc: Document, out_stream: IOBase, profile: Profile, page_number: int) Document [source]
Convert a single page of a PDF document to a rasterized image
- Parameters:
inDoc (pdftools_sdk.pdf.document.Document) – The input PDF document
outStream (io.IOBase) – The stream to which the rasterized image is written.
profile (pdftools_sdk.pdf2_image.profiles.profile.Profile) –
The profile defines how the PDF page is rendered and what type of output image is used.
For details, see
pdftools_sdk.pdf2_image.profiles.profile.Profile
.pageNumber (int) – The PDF page number to be converted. The number must be in the range of 1 (first page) to
pdftools_sdk.pdf.document.Document.page_count
(last page).
- Returns:
The image object allowing to open and read the output image and treat it 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.
ValueError – The pageNumber is not in the allowed range.
OSError – Writing to the output image failed.
pdftools_sdk.unsupported_feature_error.UnsupportedFeatureError – The input PDF is a collection that has no cover pages.
pdftools_sdk.unsupported_feature_error.UnsupportedFeatureError – The input PDF contains unrendered XFA form fields. See
pdftools_sdk.pdf.document.Document.xfa
for more information on how to detect and handle XFA documents.pdftools_sdk.generic_error.GenericError – An unexpected failure occurred.
pdftools_sdk.processing_error.ProcessingError – The processing has failed.