Hi,
I have a html page which includes img tag. Img element has src attribute as byte array like this:
When I try to convert to pdf, I got this inner exception message from Aspose.Pdf.Document: Unable to cast object of type ’ .
’ to type ’ . '.
’ to type ’ . '.
<span style=“font-size:10.0pt;mso-bidi-font-size:11.0pt;
font-family:“Arial”,“sans-serif”;mso-bidi-font-family:“Times New Roman”;
mso-bidi-theme-font:minor-bidi”><o:p></o:p>
Could you please help me?
Thanks
Related code snippet:
String path = @“C:…\test.html”;
string htmlStr;
using (StreamReader sr = new StreamReader(path, Encoding.UTF8))
{
htmlStr = sr.ReadToEnd();
}
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 20;
Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
pdflicense.SetLicense(@“C:…\Aspose.Pdf.lic”);
pdflicense.Embedded = true;
//Load HTML string
Document doc = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(htmlStr)), htmlLoadOptions);
//Save PDF file
doc.Save(@“C:…\output.pdf”);