Hi,
I have discovered the following code in PdfPage.WriteObject(PdfWriter writer):
Code:
// HACK: temporarily flip media box if Landscape
PdfRectangle mediaBox = MediaBox;
// TODO: Take /Rotate into account
if (orientation == PageOrientation.Landscape)
MediaBox = new PdfRectangle(mediaBox.X1, mediaBox.Y1, mediaBox.Y2, mediaBox.X2);
This causes a bug in our application when the input PDF contains:
Code:
/Type /Page
/Rotate 90
/MediaBox [ 0 0 595 842 ]
/CropBox [ 0 0 595 842 ]
but outputs as:
Code:
/CropBox [0 0 595 842]
/MediaBox [0 0 842 595]
/Rotate 90
/Type /Page
effectively cropping the page into a 595x595 square.
My current fix is to remove "Hack" code, can someone please advice any "unwanted side effects" out of this?
Thanks