# Load Options Open password-protected files and streams using load options in GroupDocs.Parser for Python via .NET. Use `groupdocs.parser.options.LoadOptions` to pass extra parameters when opening a document, such as a password or file type when loading from a stream. ## Open a password-protected document {{< tabs "example-1" >}} {{< tab "Python" >}} ```python 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.") ``` {{< /tab >}} {{< tab "protected.pdf" >}} {{< tab-text >}} The following sample file is used in this example: [protected.pdf](https://docs.groupdocs.com/parser/python-net/_sample_files/developer-guide/advanced-usage/loading/load-options/protected.pdf) {{< /tab-text >}} {{< /tab >}} {{< tab "open-a-password-protected-document.txt" >}} ```text Payroll summary - December 2025 Confidential: prepared by Finance for the directors of Harbor Lane Provisions. Department Headcount Gross pay Employer costs Warehouse 21 $71,400 $13,900 Drivers 9 $29,700 $5,800 Sales and customer service 7 $27,300 $5,300 Procurement [TRUNCATED] ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/advanced-usage/loading/load-options/example-1/open-a-password-protected-document.txt) {{< /tab >}} {{< /tabs >}} ## Load from a stream When you read from a stream, provide `LoadOptions` so the parser knows how to open the content (for example, password-protected PDF streams). {{< tabs "example-2" >}} {{< tab "Python" >}} ```python from groupdocs.parser import Parser from groupdocs.parser.options import LoadOptions with open("protected.pdf", "rb") as stream: options = LoadOptions("123456") with Parser(stream, 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.") ``` {{< /tab >}} {{< tab "protected.pdf" >}} {{< tab-text >}} The following sample file is used in this example: [protected.pdf](https://docs.groupdocs.com/parser/python-net/_sample_files/developer-guide/advanced-usage/loading/load-options/protected.pdf) {{< /tab-text >}} {{< /tab >}} {{< tab "load-stream.txt" >}} ```text Payroll summary - December 2025 Confidential: prepared by Finance for the directors of Harbor Lane Provisions. Department Headcount Gross pay Employer costs Warehouse 21 $71,400 $13,900 Drivers 9 $29,700 $5,800 Sales and customer service 7 $27,300 $5,300 Procurement [TRUNCATED] ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/advanced-usage/loading/load-options/example-2/load-stream.txt) {{< /tab >}} {{< /tabs >}} ### Tips - Always dispose of streams and parsers with `with` statements. - If a password is wrong, the parser raises an exception (see [errors and exceptions]({{< ref "parser/python-net/developer-guide/advanced-usage/loading/load-password-protected-documents.md" >}})). - For additional options (e.g., file type hints), see the [`LoadOptions` API reference](https://reference.groupdocs.com/parser/python-net/groupdocs.parser.options/loadoptions/).