-
Notifications
You must be signed in to change notification settings - Fork 257
Help with PDF Sharp 6.2.0 and Above with Specific PDFs with MediaBox Values and Rotation #335
I wrote up an Issue here:
#333
I am wondering since this changed in 6.2.0 and worked differently (correctly for us) in 6.1.1, is there something specific that needs to be done when building the PDF Page output when working with MediaBox values and rotation.
For instance, the PDF attached to the Issue referenced above has a mediabox object in the PDF with the values seemingly reversed, yet v6.1.1 determined the Height and Width of the PDF correctly, and I think it took the Rotation object of the media box into account (rotate 270 for instance).
It appears that in v6.2.0 and above, that is not taken into account, and that may be why the Height and Width of the PDF are being set to the literal values from the MediaBox instead of the 'effective' values based on the rendering rotation.
Any of this ringing a bell with anyone? Any ideas on how to account for this, if its a bug, etc... We will likely have to roll this library back to v6.1.1 in the meantime to get rendering working in an expected way.
All reactions
Replies: 1 comment
Any ideas on how to account for this, if its a bug, etc...
This is a documented breaking change of PDFsharp 6.2.0.
https://docs.pdfsharp.net/PDFsharp/History.html#whats-new-in-version-62
Quote: "Page orientation now works as expected
The connection between page Width, Height, PageOrientation, and PageRotation was weird. It was replaced by a consistent concept. This is a breaking change."
The media box for your file:
/MediaBox [ 0 0 2592 1728 ]
PDFsharp 6.2. returns the dimensions of the MediaBox, indicating the area that can be drawn.
If you need the old behavior, then swap width and height if page rotation is 90° or 270°.