LoadOptions class
Leave feedback
On this page
Provides the options which are used to open a file.
An instance of this class is used as a parameter in Parser constructors:
Parseraccepting a stream andLoadOptionsParseraccepting a file path andLoadOptions
See the usage examples there.
Learn more:
- https://docs.groupdocs.com/display/parsernet/Loading+specific+file+formats
- https://docs.groupdocs.com/display/parsernet/Password-protected+documents
The LoadOptions type exposes the following members:
| 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. |
| 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. |
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.")
- module
groupdocs.parser.options
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.