Hello Waldemar,
thank you very much for your reply.
I am aware of the difference in the coordinate system. The position of
the rectangle on the pdf is correct (at least as it is displayed by
Acrobat Reader). My problem is that the pdf generated by PDF Box (the
coordinates of the /rect) does not meet the expectations of the
developers of a consumer application (they may very well have incorrect
expectations).
I wanted to use a PDRectangle at first by I did not find a way to use it
to set the rectangle of a PDAnnotationWidget, therefore I switched to a
Rectangle2D.
Kind regards,
Pascasl
Am 31.01.2022 um 19:09 schrieb Waldemar Dick:
Hello Pascal,
In the PDF coordinate system origin (0, 0) is defined in the lower left of the
page.
The Java Geometrie coordinate system defines origin (0, 0) in the UPPER left.
See JavaDoc of java.awt.geom.Rectangle2D.Float#Float(float, float, float,
float).
I think that is where the confusion comes from. Try either to use a PDRectangle
or check out the code, how a Rectangle2D is converted into a PDRectangle.
Rectangle2D rect = new Rectangle2D.Float(315, 368, 224, 16);
When I open the pdf with PDFBox debugger I see "Rect 315 472 540 457"
Further, check if you need to consider page rotation in your solution.
If you do, then you will have to recalculate your x, y depending on the page
rotation (page.getRotation()).
Waldemar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org