plangrid / pdf-annotate

Pure-python library for adding annotations to PDFs
MIT License
191 stars 45 forks source link

Fix error getting transform with "reversed" boundingBox #54

Closed ignogueiras closed 3 years ago

ignogueiras commented 4 years ago

Usually a pdf boundingBox reffers to lower-left and upper-right corners, but some editors use upper-left and lower-right ones. Both forms seems to be valid according to the standard.

When computing the transform to use, pdf-annotate was using the first and second values of the bounding Box as base cordinates, trying to get the lower-left corner. This is wrong if the bounding box is reversed.

Now the correct coordinates should be taken in both cases.

ignogueiras commented 3 years ago

Hi, I have updated the PR as I found the same problem is happening when trying to get the size of the page.

ssheldonpg commented 3 years ago

Thanks, sorry for the delay I don't actually know where these notifications go but I don't seem to see them.