Dear Team,
Hello
Thanks for your inquiry. Could you please attach the document you are getting problem with? I will check it on my side and provide you more information.
Best regards,
Dear Andrey,
Hello,
Hello Anbu,
Thank you for additional information. The images inside your document are DrawingML objects. Please see the following link to learn how to work with DrawingML using Aspose.Words:
Use the DrawingML.ImageData property to work with image inside a DrawingML picture:
Please see the following code:
Document doc = new Document("C:\\Temp\\saleslist.docx");
Node[] dmls = doc.getChildNodes(NodeType.DRAWING_ML, true).toArray();
// Loop through all images
for(int i=0; i<dmls.length; i++)
{
DrawingML dml = (DrawingML)dmls[i];
if(dml.hasImage())
{
DrawingMLImageData image = dml.getImageData();
ImageSize size = image.getImageSize( );
System.out.println("Height= " + size.getHeightPixels());
System.out.println("Width= " + size.getWidthPixels());
System.out.println("-------------");
}
}
Best regards,
Thanks for the reply. I have attached document containing Image with this . I have tried above method to get the size of image, but it is giving the original image size not the modified image size .
Hi
Thanks for your request. As I can see, Aspose.Words returns correct values. Please see the attached screenshot.
Here is code I used for testing and output:
Document doc = new Document("C:\\Temp\\image.doc");
Shape shapeNode = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
System.out.println("Shape height:" + shapeNode.getHeight() + "pt; Width : " + shapeNode.getWidth() + "pt");
ImageData image = shapeNode.getImageData();
ImageSize size = image.getImageSize();
System.out.println("Image height:" + size.getHeightPoints() + "pt; Width : " + size.getWidthPoints() + "pt");
Shape height:121.53599999999999pt; Width : 162.048pt
Image height:576.0pt; Width : 768.0pt
As you can see, Aspose.Words returns the same values as MS Word.
Best regards,