I have a document assembled from other pdfs. While all the pages are in portrait orientation looking at them in code reveals that some are in landscape orientation and have a rotation of 90 or 270.
When I try to add any images or text using xgraphics the items are added vertically. I can see that the page and media box have incorrect coordinates reverse the page height and width. I don't know why it rotates the image or text + or - 90 degrees though.
I've tried changing the page orientation to portrait but that doesn't work. I tried setting rotate to 0 but that sets the page back or landscape.
I also tried to transform the xgraphics using
Code:
gfx.RotateAtTransform(90, new XPoint( page.Height/2, page.Width/2));
That works partially to rotate the text or graphics but the location is off.
I also tried
Code:
gfx.RotateTransform(90);
but then nothing is written on the page.
I don't really know what the rotateTransform or the rotateAtTransform functions are doing.
How do I get images and text to write with the correct locations when the page has a rotation of 90 or 270 and orientation says it is Landscape even though the page is being displayed as portrait?