Inserting images into PDF page with rotation


We want to insert multiple images or text into page with rotation (adding images to page without rotation is always correct). First attempt to add image to page with rotation is also correct. Every further effort finishes with image placed in other place and image rotation.

We attach simple sample project where the problem occurs (with latest avaible Aspose.PDF 18.5).

Here is sample code:

using (var document = new Aspose.Pdf.Document(fileName))
    using (var image = new MemoryStream())
        var bitmap = new Bitmap(32, 32);
        Graphics.FromImage(bitmap).FillRectangle(Brushes.Red, 0, 0, bitmap.Width, 10);
        Graphics.FromImage(bitmap).FillRectangle(Brushes.Yellow, 0, 11, bitmap.Width, 10);
        Graphics.FromImage(bitmap).FillRectangle(Brushes.Green, 0, 22, bitmap.Width, 10);
        bitmap.Save(image, ImageFormat.Bmp);

        document.Pages[1].AddImage(image, new Aspose.Pdf.Rectangle(10, 10, 42, 42));

        using (var saveStream = new MemoryStream())
            File.WriteAllBytes(fileName + "_out.pdf", saveStream.ToArray());
} (3.3 MB)

Best regards,
WEBCON Sp. z o.o.


Thank you for contacting support.

The code snippet is adding an image without any rotation and works fine as mentioned by you. Please share the code that you are using to rotate contents on 90, 180 and 270 degrees, as in the PDF files shared by you. Moreover, you can also add images to a page by adding an image stamp. In case the problem is reproduced by using already shared project, then please mention the steps of execution so that we may try to reproduce and investigate it further.


Thanks for quick answer.

We managed to get files with rotated content just by executing program on previous results.
We do not rotate any content. We do not rotate pages.

1st pass:

  • input file: Sample90.pdf
  • output file: Sample90-1.pdf

2nd pass:

  • input file: Sample90-1.pdf
  • output file: Sample90-2.pdf

3rd pass:

  • input file: Sample90-2.pdf
  • output file: Sample90-3.pdf

4th pass:

  • input file: Sample90-3.pdf
  • output file: Sample90-4.pdf

The file name means “Sample[pageRotation]-[passNo].pdf”

Best regards,
WEBCON Sp. z o.o.


Thank you for elaborating the steps to reproduce the problem.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-44776 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi there.
Any update?


Thank you for getting back to us.

We are afraid currently there are no updates regarding this issue. However, we have recorded your concerns and will let you know as soon as any further update will be available.

Hi @Farhan.Raza
Any updates regarding this issue?
Kind regards


Unfortunately, there is no update available on PDFNET-44776. We will inform you via this forum thread once there is an update available on it.

The issues you found earlier (filed as PDFNET-44776) have been fixed in Aspose.PDF for .NET 23.1.