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

Free Support Forum - aspose.com

Document content can not view after rotating a few times, maybe the data has error

After I rotated pdf file a few times, the content in document had missing when view on Chrome browser.

//open document
var pageEditor = new PdfPageEditor();
var doc = new Document(source);
pageEditor.BindPdf(doc);

//set page rotations
var pageRotations = new Dictionary<int, int>();

for (var i = 1; i <= doc.Pages.Count; i++)
{
pageRotations.Add(i, rotation);
}

pageEditor.PageRotations = pageRotations;

//save updated PDF file
using (var destination = new MemoryStream())
{
pageEditor.Save(destination);
return destination.ToArray();
}

Original file & rotated file: https://we.tl/U0gKq8dXlD

@mark.mai,
We have tested your source PDF and code with the latest version 17.9 of Aspose.Pdf for .NET API and we could see the content of the output PDF in the Chrome. This is the output PDF: Output.pdf

At present, we use version 17.2
Some files has error too.
sample02.PDF (375.7 KB)
sample.pdf (1016.2 KB)

More sample data: Original file & rotated file:https://we.tl/U0gKq8dXlD

@mark.mai,
Your three PDF documents show an error on opening them with Acrobat. However, a single PDF does not show an error and we have tried your code for this PDF document (How insurance works.pdf). We are unable to replicate the same error as we can see in your other three PDF documents. We do not provide fix in the old code base and we would recommend you please test your source PDF documents with latest version 17.9 of Aspose.Pdf for .NET API.

However, if you can replicate this error with the latest version 17.9, then share the complete details of the use case. We will investigate and share our findings with you.

I used version 17.9 and got the same issue. I realized that the size after rotation will be increased.

Sample files https://we.tl/4sFNWbdAqp

Thanks.

@mark.mai,
You have shared one source and four output PDF documents where only a single output PDF Document (rotated 4).pdf shows an error. We tried your code for multiple rotation angles, but could not replicate the same error in our environment. The size of output PDF documents is also less than your output PDF documents. Please cut off additional scenarios, and create a small project application which reproduce a PDF with error in your environment, and then send us a Zip of this project. We will investigate and share our findings with you.

This is the test project. I removed my license string. Please add license string before run test. Thanks a lot.
RotationPdfDocumentTest.zip (95.4 KB)

@mark.mai,
We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-43432 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.