Facing issue with document.appendDocument
method
com.aspose.words.Document document1 = new com.aspose.words.Document("C:/Users/c8d2k2/Desktop/Test_file/document_1.docx");
com.aspose.words.Document document2 = new com.aspose.words.Document("C:/Users/c8d2k2/Desktop/Test_file/addtionalTemplateDocument_0.docx");
document2.appendDocument(document1, ImportFormatMode.KEEP_SOURCE_FORMATTING);
document2.save("C:/Users/c8d2k2/Desktop/Test_file/WordsTest1.pdf");
Final PDF doesn’t have all the content
addtionalTemplateDocument_0.docx (19.1 KB)
document_1.docx (36.4 KB)
WordsTest1.pdf (224.5 KB)
@manasag You are using Aspose.Words in evaluation mode. There is evaluation limitation of maximum number of paragraphs in the document. You can see the following text in the output documents.
This document was truncated here because it was created in the Evaluation Mode.
If you want to test Aspose.Words for Java without the evaluation version limitations, you can request a 30-day Temporary License. Please refer to
https://purchase.aspose.com/temporary-license
Now I have tried generating the PDF with the Apose License, attached is the PDF generated even now it has the same issue
WordsTest1.pdf (209.1 KB)
@manasag Thank you for additional information. The problem is caused by different compatibility options used in your documents. If modify your code like this the problem does not occur:
Document doc1 = new Document("C:\\Temp\\doc1.docx");
Document doc2 = new Document("C:\\Temp\\doc2.docx");
doc2.appendDocument(doc1, ImportFormatMode.KEEP_SOURCE_FORMATTING);
doc2.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2007);
doc2.save("C:\\Temp\\out.docx");
doc2.save("C:\\Temp\\out.pdf");