I am trying to convert the BodyHtml of an email to a PDF with the following code:
var message = MapiMessage.FromFile(“file path”);
var pdf = new Pdf();
var section = pdf.Sections.Add();
var bodyText = new Text(section, message.BodyHtml);
bodyText.IsHtmlTagSupported = true;
section.Paragraphs.Add(bodyText);
pdf.HtmlInfo.ImgUrl = @“c:”;
pdf.Save(@“C:\mypdf.pdf”);
But I am getting the following error:
ApplicationException: The Font ‘ms sans serif’ is not found. This font is not supported.
Inner Exception: "Font ‘ms sans serif#1’ not found. Please make sure the customer font file is correctly set."
Can anyone help?
Hi Andrew,
Thank you
for considering Aspose.Pdf for .NET.
Please
share the file you are using or the HTML string with us. This will help us
figure out the issue soon. <?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
Also, which
version of Aspose.Pdf for .NET are you using? You can download and try the
latest version of Aspose.Pdf
for .NET v6.6 and see if it works fine for you.<o:p></o:p>
Thank You
& Best Regards,
I am using 6.3 but I tried it with 6.6 and I got the same results.
Here is the html I am trying. I am getting the same results on other emails too.
The following timesheets for someone are overdue:
Period Billable
Hours Non-Billable
Hours Time Off Total
Hours Productivity
Months Current Productivity
09/01/2012 to 15/01/2012 0.00 22.50 0.00 22.50 January 0.00/0 hours
It is important that you fill in the timesheet on time so that we can invoice our customers on time.
You can access Web TimeSheet at http://blah.local/Timesheet
Thanks,
Web TimeSheet Administrator
http://www.replicon.com
Timesheet Solutions Made Easy
Hi Andrew,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for sharing the template
HTML.
I think the Font “MS Sans Serif” is not
installed on your system. By default (on my Windows 7 installation) the font
installed is “MS Reference Sans Serif”. You can either use “MS Reference Sans
Serif” font in your HTML or you can download and install “MS Sans Serif” font.
Please do let us know in case you have
any other query.
Thank You & Best Regards,
I need to be able to save any email like this, is there a way I can ignore the font or use a default font?