Merge docx and document.save Pdf

I am using the Aspose-Word version 19.9, I have a problem after doing the merge of docx files, when executing a save of the pdf document in the console a warning is shown in red: "End of file reached. But it seems to be ok. There is no other images. " This is the method implemented:

public static void mergeDocx(File[] mergeFile, String savePath) throws Exception {
mergeFile = ArrayUtils.removeAllOccurences(mergeFile, null);
Document document = new Document(mergeFile[0].getAbsolutePath());
for (int i = 1; i < mergeFile.length; i++) {
if (mergeFile[i] != null) {
Document append = new Document(mergeFile[i].getAbsolutePath());
document.appendDocument(append, ImportFormatMode.KEEP_SOURCE_FORMATTING);
}
}
document.save(savePath);
}
archive_docx.zip (72.0 KB)

@pjessik,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSJAVA-2215. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@pjessik,

Regarding WORDSJAVA-2215, it is to update you that the issue appears only when ‘classpath’ does not contain JAI library (Java Advanced Imaging). In this case console output looks like the following:

End of file reached. but it seems to be ok. There is no other images.
End of file reached. but it seems to be ok. There is no other images.

But with JAI in ‘classpath’ you will not get any of these messages.

Your document contains TIFF image (it is a logo at the left upper corner of the page). In absence of JAI, Aspose.Words reads TIFF metadata with internal reader and iterate over a sequence of IDFs (Image File Directory). When there is no more data available in the image “End of file reached. but it seems to be OK. There is no other images.” message printed to console.

The message does not indicates any real error though i.e. resultant PDF contains correct logo.Put simply, there is no need to worry about such messages (we will improve it though). You may please also add JAI library for getting rid of annoying messages. Thanks for your understanding and we apologize for any inconvenience.