Free Support Forum -

Extracting Image content from DrawingML


I need to extract the byte content of nodes with the NodeType DrawingML. According to the DrawingML should expose a GetShapeRenderer method. So does It even lists an ImageData property. says "In this version of Aspose.Words, DrawingML nodes do not provide public methods and properties to create or modify a DrawingML object"

Well, I don't want to do anything... I just want the byte content. How can I get it?

Thanks in advance

Hi Anja,

Thanks for your inquiry. Please try using the following code snippet to extract bytes from DrawingML images:

Document doc = new

DrawingML dml = (DrawingML) doc.GetChildNodes(NodeType.DrawingML, true)[0];

ShapeRenderer renderer = dml.GetShapeRenderer();

MemoryStream stream = new MemoryStream();

renderer.Save(stream, new ImageSaveOptions(SaveFormat.Png));

byte[] bytes = stream.GetBuffer();

I hope, this helps.

Best Regards,