Hi Aspose team,
- I tried to flatten with the following code, but it throws “Object reference not set to an instance of an object”.
- If I remove annotations before flatten, no exception is thrown. Could you explain me why it works in this case?
Hi Aspose team,
Hi Dung,
Thanks for your inquriy. I have tested the scenario and noticed that API is throwing NullReferenceException while flattening the PDF Pages, so logged a tikcet PDFNEWNET-40530 in our issue tracking system for further investigation. As a workaround you can flatten document instead flattening Page object as following, it will help you to accomplish the task.
Document doc = new Document(@"C:\Users\Home\Downloads\exception_flatten.pdf");
doc.Flatten();
doc.Save(myDir + "exception_flatten_flattened1.pdf");
Furthermore in reference to Aspose.Pdf for .NET 11.0.0 fix, please note it was a document specific fix.
We are sorry for the inconvenience caused.
Best Regards,
Hi Tilal Ahmad,
Hi Dung,
The issues you have found earlier (filed as PDFNET-40530) have been fixed in Aspose.PDF for .NET 22.3.
Not really, we have the same problem in 22.4. NullReferenceException on the Page, not on the Document
2022-05-03_19h12_06.png (56.8 KB)
Kind Regards,
Sometimes, the issues are related to specific PDF documents and they are resolved for them particularly. Can you please share the sample PDF with which you are facing this issue? We will test the scenario in our environment and address it accordingly.
Can i send the file in a PM, because i cannot post this file publicly.
Kind Regards,
Sure, you can send your file in a private message by clicking over username and pressing the Blue Message Button.