I am inserting some images during mail merge process in Aspose Document and
finally saving it in HTML format to send as an email attachment.
Because Html output file and its images are saved on some folder on server,
when the email recipient opens the attachment, the images are not available as they are opened from the client machine and not from the server.
I want to replace value of img ‘src’ attribute value so that it changes the image reference to location on server.
Could you please guide me how can I access <img…/> tags in html document.
Thanks for your request. Aspose.Words and Aspose.Network are different products and requires different licenses. So if you would like to use Aspose.Network, you should buy license for it.
You can easily find tags in your HTML using regular expressions. Also, I think, the example provided in the following thread could be useful for you: https://forum.aspose.com/t/105718
Best regards,
Thank you for additional information. You can use the following code to convert document to HTML string:
public string ConvertDocumentToHtml(Document doc)
{
string html = string.Empty;
// Save docuemnt to MemoryStream in Hml format
using(MemoryStream htmlStream = new MemoryStream())
{
doc.Save(htmlStream, SaveFormat.Html);
// Get Html string
html = Encoding.UTF8.GetString(htmlStream.GetBuffer(), 0, (int) htmlStream.Length);
}
// There could be BOM at the beggining of the string.
// We should remove it from the string.
while (html[0] != '<')
html = html.Substring(1);
return html;
}