Hi,
I am using Aspose Total for Java to convert Word to PDF using the following code.
private void wordToPDF(InputStream inputFile, ByteArrayOutputStream output) throws Exception {
com.aspose.words.Document wordDoc = new com.aspose.words.Document(inputFile);
com.aspose.words.FontSettings fontSettings = new com.aspose.words.FontSettings();
fontSettings.setFontsFolder(ResourceUtils.getFile("classpath:fonts").toPath().toString(), true);
wordDoc.setFontSettings(fontSettings);
wordDoc.setWarningCallback(new com.aspose.words.IWarningCallback() {
@Override
public void warning(com.aspose.words.WarningInfo warningInfo) {
if (WarningType.FONT_SUBSTITUTION == warningInfo.getWarningType()) {
log.info("Missing Fonts Errors: ");
log.info(warningInfo.getDescription());
}
}
});
wordDoc.save(output, com.aspose.words.SaveFormat.PDF);
}
I added the callback function to list all warning, The major error that I am facing is that it fails to render some images and give out the following warning
“DrawingML picture rendering failed with exception:‘java.lang.IllegalArgumentException: length = 4292542543’”
It is skipping this image while converting to PDF, how can I make sure that this image is not skipped?
Is there a fix for this?
I am using the following versions:
aspose-words: 23.4
aspose-pdf: 23.4