Skip to content
Docs

Compare PDF revisions

Compare PDF revisions compares one page of a PDF with the same sheet in an earlier revision and reports what changed: which words and figures changed, which rows the revision table gained, where on the sheet the drawing differs, and a picture of it all. You find it on the node picker’s Transform & data shelf.

Suppliers send rev 1, 2 and 3 of the same sheet and do not always cloud every change. This node does the comparing. Describing the changes in a sentence is a job for an Agent after it, which you hand the regions, their words and their crops.

The node has one input handle and one output handle, and agents can call it as a tool.

A file store keeps earlier versions of a file. File each drawing under a stable path, such as Tekeningen/Titan/BW-1234-A01.pdf, in a store whose Versions to keep is at least 2, and every new revision becomes the next version of that file. Leave Compare with empty and the node compares the file with its own previous version, so the flow needs no matching logic.

You can also name the older file yourself in Compare with. For a drawing set in one PDF, pick the pages with Page and Compare with page, or turn on Match by sheet number to find the older page by the drawing number in its title block (Tekeningnr, Drawing no. and the like).

When there is nothing to compare with, the node does not fail. The first revision of a drawing, a sheet whose drawing number appears on no page of the older file, and a renumbered sheet all return "compared": false with a reason, so the flow can treat the sheet as new:

@if($prev->compared) … @else … @endif

When the previous version’s content has expired, the node compares with the newest earlier version that still has it, and says so on the run.

The node compares one page per run. To compare every sheet of a drawing set that arrives as one PDF, run it once per page in parallel. The Compare a drawing set with its previous revision template in Automation → Templates is that flow, ready to import:

  1. Read a File as Text reads the set with One document per page on, which gives one entry per sheet with its page number.
  2. A Parallel connector runs the comparison for every sheet, four at a time. A sheet that fails is reported in its place, and the other sheets still finish.
  3. Compare PDF revisions compares that sheet’s page (Page is the expression $prev->metadata->page) with the previous version of the same file, with Match by sheet number on, so a sheet that moved to another page is still paired with its earlier revision.
  4. A last step lists every sheet: whether it was compared, the share that changed, the new revision-table rows and the overlay, or the reason it was not compared.

A sheet whose title block has no drawing number the node can read is listed as not compared, with that reason. When your sets keep their page order, turn Match by sheet number off on the comparison step to compare page for page instead.

Start the flow with the drawing set’s version id as drawingSet. File each new revision of the set under the same path, in a store that keeps at least two versions, so the previous revision is the file’s previous version. To compare with a separate file instead, fill in Compare with on the comparison step.

Each sheet runs as its own step, so a large set does not run into one step’s time limit, and a retry repeats only the sheet that failed.

  • Changed words (changedWords): every word that differs, as changed (another value in the same place, such as 2500+ becoming 3800+), moved, added or removed. Neighbouring words added or removed on one line come as one phrase.
  • New revision-table rows (revisionDelta): the rows the revision table gained, often the supplier’s own summary of the revision. The table is found from its header (Rev, Datum, Omschrijving and the like) and read even though it sits inside the title block.
  • Regions (regions): the areas of the sheet that changed, largest first, each with the changed words inside it. Every changed word has a region, even a figure whose pixels barely changed.
  • Overlay (overlay): a stored picture of the whole sheet, grey where both revisions agree, red where only the old one has ink, and green where only the new one has.
  • Change ratio (changeRatio): the share of the sheet’s ink that changed, outside the masked areas.

A drawing border usually carries letters along the top and numbers down the side. The node reads them and names every change and region by the nearest letter and number: "gridRef": "D/2" is what someone on site calls “near D2”. A border with only letters gives "D". A sheet without a lettered border has no grid references.

The title block carries the revision letter and the date, so it differs on every revision. Masks leaves areas like it out of the changed words, the regions and the change ratio. Empty means title-block.

Value Leaves out
title-block The drawing’s title block, found from its labels. When the page has none, the bottom-right corner.
bottom-right 200 × 140 mm in the bottom-right corner.
right-strip The rightmost 200 mm, full height.
bottom-strip The bottom 140 mm, full width.
{"x": 0.8, "y": 0, "w": 0.2, "h": 0.1} A box as fractions of the page, measured from the top-left corner.
none Nothing: the whole sheet is compared.

Put one value per line, or give a JSON array of them. The overlay always shows the whole sheet, masked areas included, and revisionDelta is read whatever the masks say.

With Store crops on, each region (up to 12, largest first) also carries crops: three stored pictures cut around the change, old, new and overlay. Pass them to Read an Image or to an agent’s attachments together with the region’s words, and ask for one sentence per region.

The node lines the two sheets up by sliding one over the other, by up to 10 mm. warning explains why the result should not be trusted when:

  • little of the ink lines up after the best slide: the layout changed, one sheet was rescaled or rotated, or it is the wrong file;
  • the sheets line up best at the edge of the 10 mm, so they may be further apart than that;
  • one page rendered blank;
  • the two pages differ in shape. The old page is scaled to fit the new one, and what does not overlap shows as changed.

A sheet re-plotted on another paper size of the same shape, such as an A1 drawing on A0, is scaled to fit and compared normally. Small differences between two exports of one revision, a pixel or two across the sheet, are not reported as changes.

The Compare PDF revisions node's settings form, with the fields described below
The Compare PDF revisions node's settings form, with the fields described below
FieldTypeDefaultDescription
File (source)string ✦ (required) — The newer revision: a stored PDF, given as a version id, an object id, “Store name/path/to/sheet.pdf”, or an email attachment id.
Compare with (compareTo)string ✦ (optional) — The older revision to compare with. Leave empty to compare with the previous version of the same file.
Page (page)integer ✦ (optional) — The page of the newer file to compare. Empty means page 1.
Compare with page (compareToPage)integer ✦ (optional) — The page of the older file to compare. Empty means the same page number as above.
Match by sheet number (matchBySheetNumber)boolean ✦ (optional) — Find the older page by the drawing number in its title block, instead of by page number.
Resolution (dpi) (dpi)integer ✦ (optional) — The resolution the pages are compared at, in dots per inch. Empty means 150.
Region threshold (pixels) (threshold)integer ✦ (optional) — The fewest changed pixels that make a region. Empty means 16; raise it when re-exports of the same sheet show specks.
Masks (masks)string ✦ (optional) — Areas left out of the comparison because they change on purpose. Empty means the title block. One per line: title-block, bottom-right, right-strip, bottom-strip, or a box such as {“x”: 0.8, “y”: 0, “w”: 0.2, “h”: 0.1}. “none” compares everything.
Store crops (crops)boolean ✦ (optional) — Also store, for each region, the old and new sheet and the overlay cut around it, for an AI node that looks at the changes.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

File and Compare with pick a stored file. Type part of its path, and the field lists the matching files of every file store in your workspace as Store › path, the newest first, 50 at most. A picked file is saved as its object id, so the node reads the file’s newest version. For a version id, an email attachment or a file a trigger hands over, click Insert a value ({x}) and write an expression. A reference typed in before the field became a picker stays as it was.

{
"compared": true,
"reason": null,
"new": { "versionId": "…", "version": 2, "key": "Titan/BW-1234-A01.pdf", "filename": "BW-1234-A01.pdf", "page": { "page": 1, "paper": "A1", "orientation": "landscape" } },
"old": { "versionId": "…", "version": 1, "key": "Titan/BW-1234-A01.pdf", "filename": "BW-1234-A01.pdf", "page": { "page": 1, "paper": "A1", "orientation": "landscape" } },
"dpi": 150,
"changeRatio": 0.0209,
"warning": null,
"changedWords": [
{ "kind": "changed", "old": "2500+", "new": "3800+", "box": { "x": 708.7, "y": 317.1, "w": 33.5, "h": 11.5 }, "gridRef": "C/1" },
{ "kind": "changed", "old": "UNP140", "new": "UNP160", "box": { "x": 1672.4, "y": 404.8, "w": 39.6, "h": 11.5 }, "gridRef": "E/2" }
],
"revisionDelta": [
{ "revision": "C", "text": "C 22-09-2026 trap verlengd", "box": { "x": 1851.8, "y": 1467.4, "w": 336.9, "h": 9.9 } }
],
"regions": [
{ "box": { "x": 1190.3, "y": 706.5, "w": 115.2, "h": 145.9 }, "gridRef": "D/3", "changedPixels": 2105, "words": [] },
{ "box": { "x": 705, "y": 313.4, "w": 40.8, "h": 18.7 }, "gridRef": "C/1", "changedPixels": 28, "words": [{ "kind": "changed", "old": "2500+", "new": "3800+" }] }
],
"overlay": { "id": "…", "versionId": "…", "key": "compare/…/overlay.png", "filename": "overlay.png", "mediaType": "image/png", "width": 4967, "height": 3509 }
}

Boxes are in points (1/72 inch) from the top-left corner of the new page; a removed word’s box is where it was, placed on the new page. A moved word also carries from, where it used to be. The output also carries the alignment the node found (alignment), the masked areas (masks) and how long each step took (timingsMs).

With "compared": false, old, dpi, changeRatio and overlay are null and the lists are empty.

The overlay and crops are kept in the workspace’s Document renders store for 30 days.

A drawing register flow that compares every new revision as it arrives:

  1. A When Files Change trigger watches the drawings store.
  2. Compare PDF revisions gets the changed file as File, with Store crops on.
  3. An Agent receives changedWords, revisionDelta and each region’s words and crops, and writes one sentence per change.
  4. The sentences and the overlay go into the register row for the drawing.
  • Only one page of each file is compared per run. For a whole set, see Comparing a whole drawing set.
  • The sheets are lined up by sliding, not by rotating. A rotated or skewed scan does not line up and gets a warning.
  • A page larger than the platform’s pixel limit (about an A0 sheet at 150 dpi) is compared at a lower resolution, and dpi says which. A page that would need less than 50 dpi is refused.
  • Resolution (dpi) accepts 24 to 300.
  • Text drawn as lines rather than letters, as some CAD exports do, has no words to compare. Its changes still show as regions and in the overlay, and the crops let a model read them.
  • A file that is not a PDF, or a page the file does not have, fails the node.
  • Read a File as Text: a drawing’s title block or a page as text.
  • Read an Image: what a crop of a sheet shows, with a legibility flag.
  • Files: stores, versions and what was read from a file.