Save Comparison Result in a Different Format

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 →

The simplest way to control the output format of a comparison is to pick a result file path with the matching extension. GroupDocs.Comparison infers the output format from the extension and produces a result file in that format.

Example: Export a DOCX vs DOCX diff to PDF

from groupdocs.comparison import Comparer

def save_comparison_result_in_different_format():
    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")
        # Output is inferred from the file extension — .pdf in this case.
        comparer.compare("./result.pdf")

if __name__ == "__main__":
    save_comparison_result_in_different_format()

source.docx is the source file used in this example. Click here to download it.

target.docx is the target file used in this example. Click here to download it.

Binary file (PDF, 25 KB)

Download full output

Supported output formats depend on the source file type. Common targets include DOCX, PDF, and HTML.

Use case: deliver a PDF diff to stakeholders while keeping DOCX for editing.