Issues calculating viewer coordinates for a rotated PDF page. #1725
Unanswered
sameer-roofr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a service that accepts annotations with coordinates and dimensions and places them on a PDF page. Standard functions like page.drawRectangle and pdfPage.drawText work correctly with some adjustments. However, when working with a rotated PDF page, I am facing challenges.
Specifically, the PDF coordinates and viewer coordinates differ, which is expected. To address this, I wrote a wrapper function to convert PDF coordinates to viewer coordinates. However, I noticed that when a PDF page is rotated, the library still returns the original (unrotated) dimensions via page.getSize(). For example, if a rotated page appears as 1000x800 in the viewer, page.getSize() still returns 800x1000 (its original dimensions at 0 degrees).
Is there a way to get the viewer coordinates or the correctly rotated dimensions for a PDF page instead of the original unrotated values?
tldr; I want to know how to get viewer coordinates, origin (0,0) is top-left, for rotated PDF pages.
Beta Was this translation helpful? Give feedback.
All reactions