Feat: Add ignore-areas - #95
Conversation
Ignored area is defined by passing position (from the upper left corner), width and length of the rectangle.
separated by semicolon
|
Thanks! This looks well-written to me. Can you please clarify these parts?
Color from one of the documents, I take it?
Is this PDF output only or in the GUI viewer too? Makes sense to have it in both I think... |
Negative coordinates are now causing an error, just like negative height/width did
|
While testing with the --view option again, I also noticed a small bug: the preview is not shown when --output-diff is also specified. |
Yes, that is clear (and reasonable). But my question was which of the two possibly different pixels do you choose? Left or right? This is an area where the 2 documents may differ without the diff being rendered. You say that the "original (unmodified) page content" is used, but that can't be — because there are two of them. So which do you pick?
IIRC these are mutually exclusive modes. |

Added an --ignore-area feature that allows users to define one or more rectangular regions to be excluded from PDF comparisons. Multiple rectangles can be specified as a ;-separated list (e.g. --ignore-area="10,10,50,100;20,20,50,100).
This is useful for documents that contain dynamic content such as serial numbers, timestamps, or unique identifiers reoccurring on every page at the same position. In my use case, each generated document contained one or more unique codes (data matrix codes) at fixed positions on the page, causing otherwise identical PDFs to be reported as different.
Pixels within an ignored area are excluded from the pixel-diff count and don't trigger the page-differs flag, but are still rendered using the original (unmodified) page content rather than the diff color overlay. In the output diff PDF, ignored areas are additionally marked with a dashed gray outline so it's clear they were excluded intentionally rather than simply matching.