LoadOptions class

LoadOptions class

Provides the options which are used to open a file.

An instance of this class is used as a parameter in Parser constructors:

See the usage examples there.

Learn more:

The LoadOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new LoadOptions instance with an empty password, unknown file format, and default encodings.
init Initializes a new LoadOptions instance with a timeout.
init Initializes a new LoadOptions instance with the file format set to FileFormat.Unknown and default encodings.
init Initializes a new LoadOptions instance with an empty password and default encodings.
init Initializes a new LoadOptions instance with the specified password and default encodings.
init Initializes a new instance of LoadOptions with custom encodings.
init Initializes a new instance of LoadOptions with full customization.
init Initializes a new instance of the LoadOptions class with an empty password and default encodings.
init Initializes a new LoadOptions instance with the specified file type and password, using default encodings.
init Initializes a new LoadOptions instance with custom encodings.
init Initializes a fully customized LoadOptions instance.

Properties

Property Description
default_ansi_encoding The default ANSI encoding used for encoding detection.
encoding The encoding of the document.
file_format The file format as a FileFormat enumeration.
file_type The file type.
password The password used to open a password‑protected file. This property is a string value representing the password.
timeout The timeout as a timedelta representing the number of milliseconds to wait.

Example

from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions

options = LoadOptions("123456")  # password for the protected document

with Parser("protected.pdf", options) as parser:
    reader = parser.get_text()
    text = reader.read_to_end() if reader is not None else None
    print(text if text is not None else "Text extraction isn't supported.")

See Also