How to get title and description of Image using Java

How to get title & description of Image/Picture?

Set using Right clicking Image > Format Options > Alt text

I am able to get description using following code, How to get Title?

public class AsposeTest {
public AsposeTest(String src) throws Exception {
Document doc = new Document(src);
System.out.println("PAGES: " + doc.getPageCount());
NodeCollection shapes = doc.getChildNodes();
this.processChilds(shapes, 1);
}
<span class="code-keyword" style="color: rgb(0, 0, 145);">private</span> void processChilds(NodeCollection shapes, <span class="code-object" style="color: rgb(145, 0, 145);">int</span> level) {
    <span class="code-keyword" style="color: rgb(0, 0, 145);">for</span> (Node node : (Iterable<Node>) shapes) {<span class="code-comment" style="color: rgb(128, 128, 128);">

if(node instanceof CompositeNode) {
CompositeNode sec = (CompositeNode) node;
this.processChilds(sec.getChildNodes(), level+1);
}
if(node instanceof DrawingML) {
DrawingML shape = (DrawingML) node;
if (shape.hasImage()) {
System.out.println("DESCRIPTION: " shape.getAlternativeText().trim());
}
}
}
}
}

Hi Nachiket,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the Alt Text title property for DrawingML. Aspose.Words supports the DrawingML.AlternativeText which get or set the alternative text (description).

However, we had already logged this feature request as WORDSNET-8122 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

Moreover, It would be great if you please share your input document here for further investigation purposes. We will then provide you more information on this along with code.

The issues you have found earlier (filed as WORDSNET-8122) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(23)
Hi Nachiket,

Thanks for your inquiry. We removed the DrawingML from our APIs in Aspose.Words 15.2.0. So, the issue WORDSNET-8122 (Support of Alt Text Title property in DrawingML) was closed. Please read about public API changes in Aspose.Words 15.2.0 from following link.

We logged separate feature request as WORDSNET-12918 to get/set Alt Text Title property of Shape. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-12918) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

@nachiket_p

It is to inform you that starting from Aspose.Words 16.3 you can set and get the title of shape using Shape.Title property. Following code example shows how to set title of shape object.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create test shape
Shape shape = new Shape(doc, ShapeType.CUBE);
shape.setWidth(431.5);
shape.setHeight(346.35);
shape.setTitle("Alt Text Title");

builder.insertNode(shape);