What do you want to achieve?
Typically, iText takes into account the value of page rotation. This means that when you rotate the page, the coordinates will also be rotated.
If you want to undo this, you can add this line:
stamper.RotateContents = false;
This is explained in chapter 6 of my book . You can try this example to see the difference:
- No rotation, the text is added normally: hello1.pdf
- Rotation, the text is added normally (= rotated): hello2.pdf
- Rotate, text added ignoring rotation: hello3.pdf
Of course, this assumes that rotation has been defined for the pages. Sometimes a landscape mimics by defining a different page size rather than defining a rotation.
In this case, you should also read Chapter 6 because it explains how to get a MediaBox document. see the PageInformation example, which introduces methods like GetPageSize() , GetRotation() and GetPageSizeWithRotation() .
All this is documented, but if it does not answer your question, please clarify. As the example shows, rotation is taken into account by default when adding new content, so maybe I did not understand this question.
source share