Skip to content

Commit

Permalink
Merge pull request #357 from Hacnar/check-rotate-when-modifying-exist…
Browse files Browse the repository at this point in the history
…ing-PDF

Added condition, which checks /rotate when modifying landscape PDFs
  • Loading branch information
ststeiger committed Apr 18, 2023
2 parents 36b0675 + be9d18e commit 5ce247e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions PdfSharpCore/Pdf/PdfPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,7 @@ internal override void WriteObject(PdfWriter writer)
{
// HACK: temporarily flip media box if Landscape
PdfRectangle mediaBox = MediaBox;
// TODO: Take /Rotate into account
if (_orientation == PageOrientation.Landscape)
if (_orientation == PageOrientation.Landscape && Math.Abs(Rotate / 90) % 2 == 0)
MediaBox = new PdfRectangle(mediaBox.X1, mediaBox.Y1, mediaBox.Y2, mediaBox.X2);

#if true
Expand Down

0 comments on commit 5ce247e

Please sign in to comment.