You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the PDF Reference 1.7 document, all examples of /Rect specify 4 coordinates in this order: minX, minY, maxX, maxY. In other words: bottom left corner, top right corner.
Section 8.4.4 (Appearance Streams), algorithm 8.1 step 2, hints that this might be the standard order for the coordinates; I couldn't find it in the document anywhere searching for 'Rect'.
We have encountered PDFs that specify /Rect using maxX, minY, minX, maxY. In other words: bottom right, top left. The constructed PdfRectangle is then incorrect. In our case it ultimately leads to a bounding rectangle with correct height, but width 0.
I see these possibilities (the first two involve taking min/max values of x1/x2 and y1/y2 respectively):
Sanitize the input before creating a PdfRectangle - requires checks and changes in approx 60 locations where the constructor is called
Fixing the corners in the PdfRectangle constructor
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In the PDF Reference 1.7 document, all examples of /Rect specify 4 coordinates in this order: minX, minY, maxX, maxY. In other words: bottom left corner, top right corner.
Section 8.4.4 (Appearance Streams), algorithm 8.1 step 2, hints that this might be the standard order for the coordinates; I couldn't find it in the document anywhere searching for 'Rect'.
We have encountered PDFs that specify /Rect using maxX, minY, minX, maxY. In other words: bottom right, top left. The constructed PdfRectangle is then incorrect. In our case it ultimately leads to a bounding rectangle with correct height, but width 0.
I see these possibilities (the first two involve taking min/max values of x1/x2 and y1/y2 respectively):
What would be the right approach?
Beta Was this translation helpful? Give feedback.
All reactions