red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

Page exclusions #98

Closed jayalakshmijayant closed 3 years ago

jayalakshmijayant commented 3 years ago

Hello, First of all, thanks for this utility. I am slightly confused as to how to get the coordinates for the exclusions. I read the help comments in that class, looks like something is off.

finsterwalder commented 3 years ago

Exclusions are always specified as rectangles. A rectangle is fully specified by providing two points in a coordinate systems. The upper left point of the rectangle and the lower right point of the rectangle. When you specify those two points, you can draw a rectangular shape with horizontal and vertical lines. In the following picture the two stars are the points that are specified. The plus signs don't need to be specified.

*---------+ +---------*

Example: x1 = 20 y1 = 30 x2 = 100 y2 = 150 draws four lines: 20, 30 => 100, 30 20, 30 => 20, 150 100, 30 => 100, 150 20, 150 => 100, 150

jayalakshmijayant commented 3 years ago

Thank you so much for explaining this ! I was using "pt" as unit of measurement in PDF and trying to use the API instead of .conf file. Once I corrected it, I got the correct results.