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

Free Support Forum - aspose.com

PDF Doc Generation looses content formatting

Hello Aspose Team,

Need your quick help to resolve an issue that I am facing while working on the licensed copy of Aspose Words and PDF.

The issue is demonstrated as shown in the PDFIssue.jpg (attached herewith) file where the formatting of “Compliance Statement” is badly formatted.

I am using the below given code to insert 2 rtf files viz. One.rtf (that displays the html table) and Two.rtf (that displays Compliance statement). After generating both word and pdf files the pdf files reflect this issue.

This issue only occurs with these 2 particular rtf files but the html dom of both these seems to be correct.

Can you please help us know if this is an Aspose API insertDocument bug or an issue with rtf generation etc… ??

Code snippet which I am using is as below…

com.aspose.words.DocumentBuilder tempDocBuilder = new com.aspose.words.DocumentBuilder(templateDoc);


tempDocBuilder.insertDocument(sourceDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);

To fix this issue I just added below code after the above snippet and it worked perfectly fine but then it inserts 2 empty lines in between the 2 rtf’s

tempDocBuilder.writeln(); tempDocBuilder.writeln();

Your quick reply and help much appreciated. thanks in advance !

Hi Amit,

Thanks for your inquiry. You are moving the cursor to a bookmark and insert the document into another document. Your shared documents do not contain the bookmark. It would be great if you please share following detail for investigation purposes.

  • Please attach your input rtf files which you are using at your end.
  • Please create a standalone Java application (source code without compilation errors) that helps us reproduce your problem on our end.
  • Please attach the output Pdf file that shows the undesired behavior.

Unfortunately, it is difficult to say what the problem is without the Document(s) and simplified application. We need your Document(s) and simple project to reproduce the problem. As soon as you get these pieces of information to us we'll start our investigation into your issue.

Hello Tahir - Thanks for the quick response ! For now we have temporarily resolved this issue by fixing cell format in the word template.

So for now we can mark this issue as closed. Thank you once again !

Hi Amit,

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