Free Support Forum - aspose.com

HTML to PDF - Font Issue

I am getting the exception "The Font ‘serif’ is not found. This font is not supported."


How can this be fixed? Ignoring the font will also work for me.

Hi Bibekananda,


Thanks for using our products.

Can you please share the source HTML file so that we can test the scenario at our end. We are sorry for this inconvenience.

Hi,


Here the HTML and style files are separate, also it contains images.

The attached zip file ‘sample.zip’ contains these files.

Thanks,
Bibekananda

Hi Bibekananda,


Thanks for sharing the resource files.

I have tested the scenario using Aspose.Pdf for .NET 7.6.0 over Windows 7(64) and I am unable to notice any issue during PDF generation. However I have observed the formatting issues in resultant PDF file. For
the sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-34783. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

I have used the following code snippet.

[C#]

// Instantiate an object PDF class<o:p></o:p>

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

// add the section to PDF document sections collection

Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object

StreamReader r = File.OpenText(@"C:\pdftest\SampleHMTL\4-ibooks_page.html");

//Create text paragraphs containing HTML text

Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());

// enable the property to display HTML contents within their own formatting

text2.IsHtmlTagSupported = true;

//Add the text paragraphs containing HTML text to the section

section.Paragraphs.Add(text2);

// Specify the URL which serves as images database

pdf.HtmlInfo.ImgUrl = @"C:\pdftest\SampleHMTL/";

pdf.SetUnicode();

//Save the pdf document

pdf.Save(@“C:\pdftest\SampleHMTL\4-ibooks_page_HTML2pdf.pdf”);



PS, For your reference, I have also attached the resultant PDF file which I have generated over my end.