MJLaukala wrote:
"Rotation and orientation are independent properties." That's only partly true. The orientation is set for a PdfPage of an opened document. But it can be set afterwards witch does not immediately affect anything.
"orientation is internal to PDFsharp" Kinda true. While it does not get saved to the pdf document, it is used incorrectly to determine the dimensions of the MediaBox and other values which is the whole reason behind my post. It's breaking the way pdfs should be saved.
Commenting out those lines of code is essentially setting the orientation to PageOrientation.Portiat (the default value). While it is easier to write code using an enum over testing the rotation every time it is needed, everywhere in the code that actually uses the Orientation property seems to be incorrect. From what I can tell, after all the fixes it wont even be necessary to have. If anything, it needs to not affect other values, have a private setter and only be updated when the rotation of the page is set.
Tomorrow, I'm going to write my suggested fix in this reply and do a pull request. If they accept it, Awesome. If not, At least I'll have a proper fix until they deal with it.
Please, take a look at some modification I'm using to handle portrait and landscape PDF (I've just posted the code in the forum).
http://forum.pdfsharp.net/viewtopic.php?f=3&t=3247Now it works with portrait and Landscape (90° rotations)
It doesn't works with landscape rotated by 270°