- Code: Select all
Spire.Pdf.PdfDocument pp = new Spire.Pdf.PdfDocument();
Spire.Pdf.PdfPageSettings pst = new Spire.Pdf.PdfPageSettings();
PdfHtmlLayoutFormat format = new PdfHtmlLayoutFormat();
format.FitToPage = Clip.Both;
format.Layout = PdfLayoutType.OnePage;
pst.Size = Spire.Pdf.PdfPageSize.Letter;
pst.Orientation = Spire.Pdf.PdfPageOrientation.Portrait;
pst.SetMargins(0);
string testUrl = theDestUrl;
Thread thread = new Thread(() =>
{
pp.LoadFromHTML(testUrl, true, true, false, pst, format);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
string path = pathToSaveFile;
pp.SaveToFile(path, Spire.Pdf.FileFormat.PDF);
The html page has a link to a css file that specifies fonts like so
- Code: Select all
@font-face {
font-family: 'Some Font';
src: url('fonts/fontFile.eot');
src: url('fonts/fontFile.eot?#iefix') format('embedded-opentype'),
url(fonts/fontFile.otf);
}
We then have an H2 set to use that font family like this
- Code: Select all
font-family: 'Some Font', Arial, sans-serif;
When we open the page that is to be converted to a pdf in IE the correct font is displayed, however, in the resulting pdf Arial is displayed.
How can I get it to display the correct font on the pdf?