Hi Awais,
I tried the latest version of Aspose words (15.4.0) in order to use the new Warning Callback feature to detect missing images but I have some strange behavior.
Again, I tried to convert two very simple htmls :
"<p>Here is a valid image</p><p><img src=\"http://www.contract-live.com/img/logo-gray.png\" /></p>"
And
"<p>Here is a invalid image</p><p><img src=\"http://not_existing_image.png\" /></p>"
I used the following code :
final Document document = new Document();
final DocumentBuilder builder = new DocumentBuilder(document);
builder.insertHtml(html);
final PdfSaveOptions so = new PdfSaveOptions();
so.setWarningCallback(new IWarningCallback() {
@Override
public void warning(final WarningInfo info) {
System.out.println("GOT : " + info.getSource() + ", " + info.getDescription() + ", " + info.getWarningType());
}
});
final ByteArrayOutputStream result = new ByteArrayOutputStream();
document.save(result, so);
final FileOutputStream fos = new FileOutputStream("test.pdf");
try {
fos.write(result.toByteArray());
} finally {
fos.close();
}
I got those two outputs :
GOT : 2, DrawingML shape is replaced with fallback Shape, some formatting might be lost., 65536
GOT : 1, DrawingML shapes are not fully supported. Object could be rendered differently.
At DrawingML Object 167.25x26.25, Paragraph 3, Section 1, 65536
GOT : 1, DrawingML shapes are not fully supported. Object could be rendered differently.
At DrawingML Object 167.25x26.25, Paragraph 3, Section 1, 65536
AND
GOT : 2, DrawingML shape is replaced with fallback Shape, some formatting might be lost., 65536
GOT : 1, DrawingML shapes are not fully supported. Object could be rendered differently.
At DrawingML Object 24x24, Paragraph 3, Section 1, 65536
GOT : 1, DrawingML shapes are not fully supported. Object could be rendered differently.
At DrawingML Object 24x24, Paragraph 3, Section 1, 65536
I’m a bit confused because I was expecting more differences than just “167.25x26.25” vs “24x24”.
Can you help me on this ? Am I missing something ?
Thanks
NB : setWarningCallback is deprecated but I couldn’t find which method I should call instead. Can you help me on this too ?