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

Free Support Forum - aspose.com

Html Placeholder for base64 data of tag img

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

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

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);
    option.setExportImagesAsBase64(true);
    aspose-words version 19.8.

Is it possible to replace Picture?
Thanks!

@rubcs

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>>">
</img>

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.MoveTo(shape);
    builder.InsertImage(MyDir + "input.png");
    shape.Remove();
}

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