We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The added image is flipped

Hi

FlippedImage.zip (301.3 KB)

Aspose.PDF version 22.5
I am adding an image to a pdf file following this example: http://products.aspose.com/pdf/net/images/add/

But after saving to a new pdf-file, I see that the image is flipped upside down.
How to fix it?

The source code and files are attached in a zip archive.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-53568

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@PoweRDeaD
after investigation our code and sample document, I see that reason of the issue is in concatenation matrix operator in the start of the page contents:
1 0 0 -1 0 841.889764 cm
q

i.e. all page contents is rotated (including image you added).
You could add GSave operator (q) in the start of the page contents and GRestore after its end, something like that:

    page.Contents.Insert(1, new Aspose.Pdf.Operators.GSave());
    page.Resources.Images.Add(imageStream);
    page.Contents.Add(new Aspose.Pdf.Operators.GRestore());

or update your matrix according yo the page contents rotation.
I’ve created ticket PDFNET-53568 for more detailed investigation of the issue.

You could add GSave operator (q) in the start of the page contents and GRestore after its end, something like that

Not helping

or update your matrix according yo the page contents rotation.

How can I know if the content of the page is upside down?
And how to rotate the matrix, is there an example?

@PoweRDeaD
I’ve created ticket PDFNET-53568 for more detailed investigation of the issue. We will inform you when PDFNET-53568 is fixed.