We are using aspose-words-20.1-jdk17.jar to convert word document and we are facing issues with images conversions. Please check and avise.
String inputPath = "C:\\test\\19903test\\test001\\30032838.docx";
String outputPath = "C:\\test\\19903test\\test001\\output";
String imageName = "test001.png";
Document asposeDoc = new Document(inputPath);
String drawingName = "Chart 18";
Iterable<Shape> shapes = (Iterable<Shape>) asposeDoc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : shapes) {
String drawingNameByAspose = shape.getName();
if (drawingNameByAspose != null && drawingNameByAspose.equals(drawingName)) {
try {
shape.getShapeRenderer().save(outputPath + File.separator + imageName, new ImageSaveOptions(SaveFormat.PNG));
} catch (Exception t) {
throw new RenditionConversionException("Failed to save chart to disk, drawingName " + drawingName + ", imageName " + imageName, t);
}
}
}
30032838.docx (65.4 KB)