Skip to content

Commit

Permalink
Merge pull request #393 from noctis0430-open-source/Issue/389
Browse files Browse the repository at this point in the history
Fix #389
  • Loading branch information
ststeiger authored Sep 27, 2023
2 parents a65b38d + 8b5fa7b commit df829ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PdfSharpCore/Pdf.Advanced/PdfFormXObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ internal PdfFormXObject(PdfDocument thisDocument, PdfImportedObjectTable importe

// Translate the image such that its center lies on the center of the rotated bounding box
double offset = (height - width) / 2;
if (height > width)
if (rotate == 90)
matrix.TranslatePrepend(offset, offset);
else
else if (rotate == -90)
matrix.TranslatePrepend(-offset, -offset);

//string item = "[" + PdfEncoders.ToString(matrix) + "]";
Expand Down
3 changes: 1 addition & 2 deletions PdfSharpCore/Pdf/PdfPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ internal PdfPage(PdfDictionary dict)
{
// Set Orientation depending on /Rotate.
int rotate = Elements.GetInteger(InheritablePageKeys.Rotate);
var mediaBox = Elements.GetArray(InheritablePageKeys.MediaBox);
if (Math.Abs((rotate / 90)) % 2 == 1 && mediaBox.Elements.GetReal(3) > mediaBox.Elements.GetReal(2))
if (Math.Abs((rotate / 90)) % 2 == 1)
_orientation = PageOrientation.Landscape;
}

Expand Down

0 comments on commit df829ba

Please sign in to comment.