pdftools_sdk.pdf2_image.converter

Classes

Converter()

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

__init__()[source]
convert_document(in_doc: PdfDocument, out_stream: io.IOBase, profile: Profile) → MultiPageDocument[source]

Convert all pages of a PDF document to a rasterized image

Parameters:
  • inDoc (PdfDocument) – The input PDF document

  • outStream (io.IOBase) – The stream to which the rasterized image is written.

  • 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:

MultiPageDocument

Raises:
convert_page(in_doc: PdfDocument, out_stream: io.IOBase, profile: Profile, page_number: int) → ImageDocument[source]

Convert a single page of a PDF document to a rasterized image

Parameters:
  • inDoc (PdfDocument) – The input PDF document

  • outStream (io.IOBase) – The stream to which the rasterized image is written.

  • 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:

ImageDocument

Raises: