Provide Java equivalent of Aspose.Words code

Hi @awais.hafeez

Can i get the above code in java?
Thanks…

@resh05,

Please check the following Aspose.Words for Java code:

Document doc = new Document("Test1.docx");

Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);
if (shape.hasChart())
{
    ShapeRenderer renderer = shape.getShapeRenderer();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    {
        renderer.save(baos, new ImageSaveOptions(SaveFormat.PNG));
        DocumentBuilder builder = new DocumentBuilder(doc);
        builder.moveTo(shape);
        builder.insertImage(baos.toByteArray());
        shape.remove();
    }
}

doc.save("18.1.pdf");

Hope, this helps.

Hi @awais.hafeez
Thanks for the code… its working fine…:blush: