We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extract shapes using paragraph nodes (render as png image) in JAVA

Hi @tahir.manzoor ,

Requiring a work around solution to

  • extract shapes

  • charts

  • group images(Consecutive images - shape followed by another shape till figure caption exists)

  • images inside table (extract all images inside table together)

  • Equations

Render all shapes as image (PNG format) using paragraph node mechanism.

Thanking you in advance
Regards
Priya Dharshini J PSample.zip (2.8 MB)Sample2.zip (363.8 KB)

@priyadharshini,

Thanks for your inquiry. You can use the same approach to extract the contents shared in other posts. E.g. please check the following forum thread.
Extract shapes/images using paragraph node in JAVA

Please check the following code snippet to export the extracted content into image. Hope this helps you.

for (Shape shape : (Iterable<Shape>) shapes)
{
    NodeImporter importer = new NodeImporter(doc, dstDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
    Node newNode = importer.importNode(shape, true);
    dstDoc.getFirstSection().getBody().getFirstParagraph().appendChild(newNode);

    ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
    options.setPageIndex(0);
    dstDoc.save(MyDir + "output"+i+".png", options);
    i++;
}