__init__ constructor
Leave feedback
On this page
Initializes a new LoadOptions instance with an empty password, unknown file format, and default encodings.
def __init__(self):
...
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456") # password for 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.")
Initializes a new LoadOptions instance with a timeout.
def __init__(self, timeout):
...
| Parameter | Type | Description |
|---|---|---|
| timeout | timedelta |
The timedelta that represents the number of milliseconds to wait. |
Initializes a new LoadOptions instance with the file format set to FileFormat.Unknown and default encodings.
def __init__(self, password):
...
| Parameter | Type | Description |
|---|---|---|
| password | str |
The password to open the password-protected file. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456")
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.")
```
## __init__ {#file_format}
Initializes a new LoadOptions instance with an empty password and default encodings.
```python
def __init__(self, file_format):
...
| Parameter | Type | Description |
|---|---|---|
| file_format | FileFormat |
The format of the file. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456")
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.")
Initializes a new LoadOptions instance with the specified password and default encodings.
def __init__(self, file_format, password):
...
| Parameter | Type | Description |
|---|---|---|
| file_format | FileFormat |
The format of the file. |
| password | str |
The password to open the password-protected file. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions(password="123456")
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.")
Initializes a new instance of LoadOptions with custom encodings.
def __init__(self, file_format, password, encoding, default_ansi_encoding):
...
| Parameter | Type | Description |
|---|---|---|
| file_format | FileFormat |
The format of the file. |
| password | str |
The password to open the password‑protected file. |
| encoding | System.Text.Encoding |
The encoding of the document. |
| default_ansi_encoding | System.Text.Encoding |
The default ANSI encoding which is used for encoding detection. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456") # password only; other parameters are optional
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.")
Initializes a new instance of LoadOptions with full customization.
def __init__(self, file_format, password, encoding, default_ansi_encoding, timeout):
...
| Parameter | Type | Description |
|---|---|---|
| file_format | FileFormat |
The format of the file. |
| password | str |
The password to open the password‑protected file. |
| encoding | System.Text.Encoding |
The encoding of the document. |
| default_ansi_encoding | System.Text.Encoding |
The default ANSI encoding which is used for encoding detection. |
| timeout | timedelta |
The TimeSpan that represents the number of milliseconds to wait. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456") # password for a protected PDF
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.")
Initializes a new instance of the LoadOptions class with an empty password and default encodings.
def __init__(self, file_type):
...
| Parameter | Type | Description |
|---|---|---|
| file_type | FileType |
The type of the file. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
# Load a password‑protected PDF using a password string
options = LoadOptions("123456")
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.")
```
## __init__ {#file_type-password}
Initializes a new LoadOptions instance with the specified file type and password, using default encodings.
```python
def __init__(self, file_type, password):
...
| Parameter | Type | Description |
|---|---|---|
| file_type | FileType |
The type of the file. |
| password | str |
The password to open the password‑protected file. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions("123456")
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.")
Initializes a new LoadOptions instance with custom encodings.
def __init__(self, file_type, password, encoding, default_ansi_encoding):
...
| Parameter | Type | Description |
|---|---|---|
| file_type | FileType |
The type of the file. |
| password | str |
The password to open the password-protected file. |
| encoding | System.Text.Encoding |
The encoding of the document. |
| default_ansi_encoding | System.Text.Encoding |
The default ANSI encoding which is used for encoding detection. |
from groupdocs.parser import Parser
from groupdocs.parser.options import LoadOptions
options = LoadOptions(password="123456")
with Parser("protected.pdf", options) as parser:
reader = parser.get_text()
text = reader.read_to_end() if reader else None
print(text or "Text extraction isn't supported.")
Initializes a fully customized LoadOptions instance.
def __init__(self, file_type, password, encoding, default_ansi_encoding, timeout):
...
| Parameter | Type | Description |
|---|---|---|
| file_type | FileType |
The type of the file. |
| password | str |
The password to open the password‑protected file. |
| encoding | System.Text.Encoding |
The encoding of the document. |
| default_ansi_encoding | System.Text.Encoding |
The default ANSI encoding which is used for encoding detection. |
| timeout | timedelta |
The time span that represents the number of milliseconds to wait. |
from groupdocs.parser.options import LoadOptions
# Load a password‑protected PDF using its password
options = LoadOptions(password="123456")
- class
LoadOptions
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.