PDF formatting not respecting the document format

Hi,

I have a document in Aspose that is working correctly when exported to DOCX but when using PDF format it gets messed up, we don’t do any particular logic for PDF, we only export it as PDF instead.

These are some screenshots of the differences, we want to know if there are any known issues related to this and, if you can give me some guidance on where the issue may rely having in mind there are no differences in the code for PDF rendering.

DOCX

PDF (incorrect rendering)

@rmanzo7 Could you please attach your input and output documents here for testing? Unfortunately, it is impossible to analyze the problem using screenshots. We will check the issue and provide you more information.

Hi, we were debugging while posting the ticket and we didn’t have the information at that moment but we figured it has something to do with out code, fortunately, we have found the root cause of the issue. We were removing the built in styles doc.Styles.Where(x => !x.BuiltIn) as well a some other operation within a

MemoryStream documentNoStylesStream = new MemoryStream() { … }

But, saving the document two times in the same memory stream which for reason the PDF rendering was failing. As a note this was a .NET Framework 4.6.1 application, kind of old and we are using Aspose 24.2.0.

The fix applied was saving only the document once and changing the logic for removing the unused styles to other part of the process.

Thanks for your reponse and following up this ticket.

Regards.

Rafael Manzo.

1 Like

@rmanzo7 It is perfect that you managed to resolve the problem. please feel free to ask in case of any issues, we are always glad to help you.