Print PDF

I have encountered an odd issue with Aspose. The document generates and saves successfully as docx. The document has a table in it. Then, it is saved as a pdf. Here is the odd situation. If the document doesn’t contain a table, no issues. However, with a table, it alters how the table is saved as a pdf.

I took the doc and edited one character anywhere in the document and replaced it with the same character. Then, I used Aspose to save the altered document as docx and pdf. The table displays correctly. The table’s preferred width is 100%. The cells are that as well.

If anyone has scene this situation before, please let me know. Regards,

One other thing observed.

I changed the format of the cell to a calculated format. I did this by calculating the width of each column by

cellWidth = Convert.ToDouble((builder.PageSetup.PageWidth - builder.PageSetup.LeftMargin - builder.PageSetup.RightMargin)/columns);

This resolved the print by pdf and put the columns in the correct place; however, there was a consequence. Each paragraph stored in the cells had a formatting. The formatting was undone.

So, issue is not resolved with the attempted work around.

Hi Aaron,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v13.1.0) from here and let us know how it goes on your side. If the problem still remains, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.

I followed your recommendation, but the issue did not go away. I’m attaching the doc (en_US.DOCX). You can load that into Aspose and attempt to save it to PDF. That should reproduce the issue being encountered. I’ve also included the pdf as it is being viewed.
Please let me know if you need anything else from me.
Regards, Aaron

Hi Aaron,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7752 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please call Document.UpdateTableLayout method before exporting to PDF as shown in following code snippet. This method updates widths of cells and tables in the document according to their preferred widths and content. You can call this method before exporting to PDF (or any other fixed-page format), only in rare cases where you confirmed that tables appear incorrectly laid out in the output document.

I have attached the output PDF file with this post for your kind reference.

Document doc = new Document(MyDir + "Test30.docx");

doc.Save(MyDir + "out.pdf");

Hi Tahir,
Thank you for the code. It did resolve my issue.
I appreciate the resolution. Regards,

Hi Aaron,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

The issues you have found earlier (filed as WORDSNET-7752) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.