|
Rank: Newbie Groups: Member
Joined: 11/27/2012 Posts: 5
|
I used HtmlToPdf.ConvertUrl to convert my HTML page to PDF. My page refer to the CSS file with the following style:
body { background-color: white; font-family: Century Gothic, sans-serif; margin: 0; padding: 0; }
In the browser, the Century Gothic font shows up just fine. When converted to PDF, the Century Gothic font is not being used. I saw another posting in the forum that mentioned that the font must be installed. I made sure that the font is installed in my server and the century gothic is still not rendered. Am I missing something?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Please try to enclose your font name inside quotations. For example:
font-family: "Century Gothic"
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/27/2012 Posts: 5
|
I tried that and it didn't work either. One thing come into mind. Do I have to reboot the machine after installing the font before HtmlToPdf can use it? If yes, is there anyway to avoid that? This is production server and I don't want to reboot it if not necessary.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
There is no way to prevent reboot on our end. We call a Windows API to get the font data and if Windows doesn't give it to us for whatever reason, we can't do anything. However the new version (2013) has a new feature that allows you to use custom font. Custom font allows you to reference the font file directly through a Url with @font-face CSS attribute without having to install the font on the server. That should solve this kind of problems for you. However even if the new version works for you, you would still need to reboot the server (or at least your server app) once when your app switch to the new version.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/27/2012 Posts: 5
|
OK.. I'll reboot the server this weekend. My next question is regarding the new feature of referencing the font using the URL. One of our site uses the Open Sans font as described in this page: http://www.google.com/fonts#UsePlace:use/Collection:Open+Sans Can I use the above font when exporting to PDF? Right now, I loaded the font using javascript as described in the above page. And HtmlToPdf didn't render the font. Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, We tested it and it works fine. We added the following line into the header section:
Code: HTML/ASPX
<link
href='http://fonts.googleapis.com/css?family=Open+Sans'
rel='stylesheet' type='text/css'>
And the font will be loaded by the converter. Note that this is a new feature that was just added. So you may want to check whether you are trying this on the latest build. Thanks!
|
|