Load Options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

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

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.")

The following sample file is used in this example: protected.pdf

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

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).

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.")

The following sample file is used in this example: protected.pdf

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

Tips