Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Unsupported font style when converting HTML to PDF

$
0
0
Hi I am having problem converting HTML string to PDF by using DOM approach.
Here's my sample code snippet.
license.SetLicense(lic_path);
string fullPath = "C:\\OutputFolder\\"
string emailBodyDetails = "<html><body><SPAN style=""FONT-FAMILY: Calibri, 'Segoe UI', Meiryo, 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', sans-serif; FONT-SIZE: 16px"">Content.</SPAN></body><html>";
using (FileStream fs = new FileStream(fullPath + "Output.html", FileMode.Create))
{
using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
{
w.WriteLine(emailBodyDetails);
}
fs.Close();
}
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(fullPath + "Output.html", new HtmlLoadOptions() { UseNewConversionEngine = true });
doc.Save(fullPath + "Output.pdf");

I am getting error during conversion, and I found out that the html font style Meiryo is causing it, as when I remove the style from the string, it works fine. May I know how can this font be included in my document conversion?

At the same time, can I know which font are not supported in Aspose and what can I do to ensure all types of fonts are supported because we are not able to control the style usage in html as those contents are coming in from emails.

Viewing all articles
Browse latest Browse all 3131

Trending Articles