Resource Base
Table of contents

FileFetcher

The FileFetcher class is a utility class that partitions a multi-page image file into multiple independent ImageData objects. It inherits from the ImageSourceAdapter class.

Definition

Module: dynamsoft_utility

Inheritance: ImageSourceAdapter -> FileFetcher

class FileFetcher(dynamsoft_core.ImageSourceAdapter)

Methods

Method Description
__init__ Initializes a new instance of the FileFetcher class.
set_file Sets the file using a file path, file bytes or an ImageData object.
set_pdf_reading_parameter Sets the parameters for reading PDF files.
set_pages Sets the 0-based page indexes of a file (.tiff or .pdf) for barcode searching.
has_next_image_to_fetch Determines whether there are more images left to fetch.

__init__

Initializes a new instance of the FileFetcher class.

def __init__(self):

set_file

Sets the file using a file path, file bytes or an ImageData object.

def set_file(self, *args) -> Tuple[int, str]:

Parameters

args <tuple>: A variable-length argument list. Can be one of the following:

  • file_path <str>: Specifies the path of the file to process.
  • file_bytes <bytes>: Specifies the image file bytes in memory to process.
  • image_data <ImageData>: Specifies the image data to process.

Return Value

Returns a tuple containing following elements:

  • error_code <int>: The error code indicating the status of the operation.
  • error_message <str>: A descriptive message explaining the error.

See Also

ImageData

set_pdf_reading_parameter

Sets the parameters for reading PDF files.

def set_pdf_reading_parameter(self, para: PDFReadingParameter) -> Tuple[int, str]:

Parameters

para A PDFReadingParameter object with PDF files reading parameters.

Return Value

Returns a tuple containing following elements:

  • error_code <int>: The error code indicating the status of the operation.
  • error_message <str>: A descriptive message explaining the error.

See Also

PDFReadingParameter

set_pages

Sets the 0-based page indexes of a file (.tiff or .pdf). By default, there is no restriction on the number of pages that can be processed in a single file.

def set_pages(self, pages: List[int]) -> Tuple[int, str]:

Parameters

pages An integer list containing the page information to be set.

Return Value

Returns a tuple containing following elements:

  • error_code <int>: The error code indicating the status of the operation.
  • error_message <str>: A descriptive message explaining the error.

has_next_image_to_fetch

Determines whether there are more images left to fetch.

def has_next_image_to_fetch(self) -> bool:

Return Value

Returns true if there are more images left to fetch, false otherwise.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

latest version

    Change +