Load password-protected documents

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.Comparison MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-comparison -- dnx GroupDocs.Comparison.Mcp --yes
Folders, licensing and more →

On this page

GroupDocs.Comparison allows you to compare documents that are protected with a password.

To compare password-protected documents, follow these steps:

  1. Instantiate the LoadOptions object. Specify source document password;
  2. Instantiate the Comparer object. Specify the source document path or stream and LoadOptions object created in the previous step.
  3. Instantiate another LoadOptions object. Specify target document password.
  4. Call the Add method. Specify the target document path or stream and the LoadOptions object created in the previous step.
  5. Call the Comparer method.

The following code snippet shows how to compare password protected documents:

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

LoadOptions sourceLoadOptions = new LoadOptions(){ Password = "1234" };

using (Comparer comparer = new Comparer("source.docx", sourceLoadOptions))
{
    LoadOptions targetLoadOptions =	new LoadOptions() { Password = "5678" };
    comparer.Add("target.docx", targetLoadOptions);
    comparer.Compare("result.docx");
}

See also

On this page