Class MultiPageImageExtractor

API for extracting images from multi-page images (PDF, TIFF) and single-page images (JPEG, PNG).

*

  • Required licence feature(s): ImageProcessing.

Example

Since the class is backed by native resources and implements AsyncDisposable it's highly recommended to use the await using syntax when an instance is created to ensure the resource is disposed automatically:

await using instance = await MultiPageImageExtractor.create(...);

Alternatively, one can explicitly call dispose method to release the native resource. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

Implements

  • AsyncDisposable

Methods

  • Returns Promise<void>

  • As the instance is backed by a native resource, it should be disposed when it is no longer needed. This method will release the native resource. As a recommended alternative since the class implements AsyncDisposable one can use 'await using' syntax to ensure the resource is disposed of automatically. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

    Returns Promise<void>

    A promise that resolves when the instance is disposed.

  • Extracts images from the given source. If possible, images that are originally stored in a compressed way, are not decompressed automatically but are initialized in a lazy way.

    • This means that the image data is only decompressed when it is accessed for the first time.
    • That's why when the images are used after extraction, it is recommended to close (dispose) (if platform uses Garbage Collector) images as soon as they are not needed anymore to prevent storing a lot of images in decompressed state in memory.
    • After the method is executed, the source doesn't have to exist anymore.

    Parameters

    • source: RandomAccessSource

      The source to extract images from. Supported multi-page image formats are TIFF and PDF. Supported single page image formats are JPEG and PNG.

    Returns Promise<PageExtractionResult>

    The result of the extraction.