AuraDoc
Sign inSign up

Blog

Comparing two documents and PDFs in AuraDoc

See what changed between two versions of a document: a similarity score, added and removed lines, and a page-by-page PDF comparison report.


Two versions of a contract arrive a day apart and the cover email says only "small edits". Reading both side by side is slow, and the changes that matter are often the ones you do not notice. A comparison tool exists to answer one question: what is different? AuraDoc gives you three complementary ways to answer it, depending on whether you want a quick measure, a line-by-line difference of the extracted text, or a page-by-page report on the PDF files themselves.

Comparing the text of two documents

Every document that AuraDoc processes has its text extracted, whether it was born digital or scanned and passed through OCR. The document comparison endpoint of the REST API takes two documents from your workspace and compares that extracted text. The response gives you a similarity ratio between zero and one, the number of lines added and removed, the number of characters on each side, and a unified diff, the familiar format in which removed lines start with a minus sign and added lines with a plus sign.

Two details are worth knowing. First, you must pass two different documents; asking to compare a document with itself returns an error. Second, the diff has a size limit. If the full difference is very long, the response is cut off and a flag tells you it was truncated, so your code can show the part that fits and tell the reader that there is more. Both documents have to belong to your workspace and not be deleted, otherwise the request is treated as not found.

Because this comparison works on text, its quality depends on the quality of the extraction. For a scanned file, run it through the OCR pipeline first so that there is text to compare. A change that exists only in an image, such as a different logo, will not appear in a text comparison.

Comparing PDFs page by page

For a closer look at the files themselves, PDF tools include a compare tool that takes two PDFs and produces a report. It goes through the pages in order and lists the text that was added or removed on each one. It also renders the pages of both files and measures how much they differ visually, flagging the pages where the difference is above a threshold. This catches what a text diff cannot: a moved figure, a replaced image, a changed layout. When two pages have different sizes, the tool reports a size mismatch for that page instead of a misleading difference.

The report summarises the result in a sentence, such as the number of text changes and of pages with visual differences, or a note that no significant difference was found. It also includes the page counts of both files and the changes grouped by page, so you can jump straight to page 7 instead of scanning all twelve. The visual check marks the whole page rather than the exact spot, so open the page to see where the change is. Like the other PDF tools, it runs as a background job, does not use AI and is available on paid plans. To see how it fits with merging, splitting and chaining operations, read about PDF tools and pipelines.

Finding similar documents

Sometimes you do not have two specific files in mind; you want to know whether another version already exists. A completed document has a tab for similar documents. It lists other documents from your library that resemble it, by default up to five, each with a similarity percentage, a short snippet and the reasons it was matched. It is a quick way to spot duplicates or earlier drafts before you compare them in detail.

A simple routine is to use the similar tab to find the earlier version, compare the text through the API when you want a number and a diff inside your own system, and run the PDF compare tool when layout matters. If you automate this, the REST API and webhooks let you trigger comparisons from your own tools, and the pricing page shows which plans include the PDF tools.

Back to the blog