Thank you for the solution.
If I need to append another document with similar conetnt (Automatically resize to fit contents), can I use below code?. Solution is working but wanted to check with you, if it is the rightway of doing.
Also my understanding is that deepClone will copy the document and this is useful when we wanted to generate more than one copy. appendDocuemnt will append the docuemnt to the last section of the document. Could you kindly explain how these two methods are working together in your solution. Thank you.
Document doc = new Document(“C:\Temp\Resize\input.docx”);
Document doc2 = new Document(“C:\Temp\Resize\input2.docx”);
Document merged = (Document) doc.deepClone(false);
merged.ensureMinimum();
merged = (Document) doc2 .deepClone(false);
merged.appendDocument(doc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
merged.appendDocument(doc2,ImportFormatMode.KEEP_SOURCE_FORMATTING);
merged.save(“C:\Temp\Resize\20.8.docx”);
merged.save(“C:\Temp\Resize\20.8.pdf”);