smyaseen
smyaseen

Reputation: 21

How to get PDF coordinates of specific selected area?

I've a task to compare two pdfs to which I've used the following library:

https://github.com/red6/pdfcompare

The issue is, I've to ignore some parts of pdf and I need coordinates for that. How do I get the coordinates as mentioned in the documentation? I've researched but all the tools used just shows x and y coordinates, I need 4 dimensions here.

exclusions: [
    {
        page: 2
        x1: 300 // entries without a unit are in pixels. Pdfs are rendered by default at 300DPI
        y1: 1000
        x2: 550
        y2: 1300
    },
    {
        // page is optional. When not given, the exclusion applies to all pages.
        x1: 130.5mm // entries can also be given in units of cm, mm or pt (DTP-Point defined as 1/72 Inches)
        y1: 3.3cm
        x2: 190mm
        y2: 3.7cm
    },
    {
        page: 7
        // coordinates are optional. When not given, the whole page is excluded.
    }
]

I want to ignore the following in a PDF

area to ignore in pdf

Thank you.

Upvotes: 1

Views: 3110

Answers (1)

smyaseen
smyaseen

Reputation: 21

Thanks to @Olivier for directing me. I used GIMP to load the PDF, and selected the upper left area of the area I want to ignore, and I copied the position. The same I did with lower right. Then I pasted the uper-right into x1 and y1, and lower-right into x2 and y2. Now, it's working as expected. Thank you all.

The attached screenshot showed what I did.

upper-left lower-right

Upvotes: 1

Related Questions