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

Free Support Forum - aspose.com

Html Placeholder for base64 data of tag img

i want generate html with placeholder for base64.
My html template is

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <img src="data:image/png;base64,<<Picture>>">

I also tried replacing
img as

  1. <img src="data:image/png;base64,&lt;&lt;Picture&gt;&gt;">
    does not work
  2. <img src=&quot;data:image/png;base64,&lt;&lt;Picture&gt;&gt;&quot;>
    does not work.
    My save option as
    HtmlSaveOptions new= HtmlSaveOptions(SaveFormat.HTML);
    aspose-words version 19.8.

Is it possible to replace Picture?


You can add “alt” attribute in img tag and use following code example to get the desired output.

<img src=“data:image/png;base64,” alt="<<Picture>>">

Document doc = new Document(MyDir + "input.html");
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

if (shape.HasImage && shape.AlternativeText == "<<Picture>>")
    builder.InsertImage(MyDir + "input.png");

doc.Save(MyDir + "19.9.docx");