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

Free Support Forum - aspose.com

How to retain RTF Formatting (tables- Header/Footer) in PDF file using Aspose.Words.jdk16.jar

Hi,

I am using Aspose.Words.jdk16.jar creating RTF files and able to render Header/Footer and tables with dynamic values easily. Right now, I have a new requirement that is, to render the same content to PDF file too.

I used this Aspose.Words.jdk16.jar and tried to save the same content (Dynamic Header and Footer and Dynamic Tables) as .pdf file. But the alignment is not same as RTF.

Can any one suggest me on “How can I retain the same Formatting (Tables and Page Setup and alignment) in PDF file” using the above jar.

Please provide if you have any java code to read and write the same formatting into PDF file.

Thanks You,
Muthu


Hi Muthu,

Thanks for your inquiry. Could you please attach your input Word document (.rtf file) and output PDF file showing the undesired behavior here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Thank you for your reply.

Attached is the sample .pdf file generated.

I tried 2 methods.
---------------------
1. Generate .pdf file using doc.save(.pdf).
2. Generate .rtf file using doc.save(
.rtf) and open the same .rtf docuemnt using document object and save it using doc.save(*.pdf).

In both the cases the .pdf file formatting and alignment is lost.

I have also attached the .rtf file generated for your reference (Alignment and formatting is fine).

Request you check on this and give your inputs.

Thanks,
Muthu

Hi Muthu,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 15.2.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-11641. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Thank you Awais for your reply.

Based on your last post, I understand that, it is not possible to render the RTF formatting into PDF formatting right now.

Could you please let me know what is the workaround so that, I can accomplish my task.

Thanks
Muthu.

Hi Muthu,

Thanks for your inquiry. In this case, you should just call Document.UpdateTableLayout method before rendering to PDF format. You can use this method only in rare cases where you confirmed that tables appear incorrect in the output document. I hope, calling this method will help to correct the output. Rest assured, we will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

Thank you Awais for the information.

It is partially working after invoking Document.updateTableLayout() method that is, the body part of the document is rendered properly but, the header and footer section of the document is not displayed as expected.

Could you suggest, “Is there any other method should I call to render the header and footer section properly”.

Thanks,
Muthu

Hi Muthu,


Thanks for your inquiry. I am afraid, there is no separate method. Currently, this issue is pending for analysis and is in the queue. We will inform you as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-11641) have been fixed in this Aspose.Words for .NET 22.5 update also available on NuGet.