Skip to content

Navigation Menu

Sign in
Sign up

Help with PDF Sharp 6.2.0 and Above with Specific PDFs with MediaBox Values and Rotation #335

Unanswered
hcornelisonJHA asked this question in Q&A
Discussion options

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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°.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
duplicate This issue or pull request already exists

AltStyle によって変換されたページ (->オリジナル) /