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

Free Support Forum - aspose.com

Can't Convert Html Doc which has img tag

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 ’ . '.

<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”);

Hi Onur,


Thanks for your inquriy. We will appreciate it if you please share your sample HTML file here, we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,