DirectoryFetcher
The DirectoryFetcher
class is a utility class that retrieves a list of files from a specified directory based on certain criteria. It inherits from the ProactiveImageSourceAdapter
class.
Definition
Module: dynamsoft_utility
Inheritance: ProactiveImageSourceAdapter -> DirectoryFetcher
class DirectoryFetcher(ProactiveImageSourceAdapter)
Methods
Method | Description |
---|---|
__init__ |
Initializes a new instance of the DirectoryFetcher class. |
set_directory |
Sets the directory path and filter for the file search. |
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 DirectoryFetcher
class.
def __init__(self):
set_directory
Sets the directory path and filter for the file search.
def set_directory(self, *args) -> Tuple[int, str]:
Parameters
args
<tuple>: A variable-length argument list that must contain following parameters in order:
path
<str>: The path of the directory to search.filter
<str, optional>: A string that specifies file extensions. For example: “*.BMP;*.JPG;*.GIF”, or “*.*”, etc. The default value is “*.bmp;*.jpg;*.jpeg;*.tif;*.png;*.tiff;*.gif;*.pdf”.recursive
<bool, optional>: Specifies whether to load files recursively. The default value is False.
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.
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
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.