Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf.ConvertUrl renders web font erratically Options
Nolan Egly
Posted: Wednesday, May 9, 2012 1:37:30 PM
Rank: Newbie
Groups: Member

Joined: 5/9/2012
Posts: 1
I'm using EO.Pdf 3.0.120.2 to render an html page to pdf with HtmlToPdf.ConvertUrl(). The page includes web fonts with a barcode font. The HtmlToPdf will not render the web font at first, then it will, then it won't, and then it will consistently. I have a complete sample I can submit, here's a summary:

CSS:

@font-face {
font-family: 'barcode';
src: url('fonts/fre3of9x-webfont.eot');
src: url('fonts/fre3of9x-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/fre3of9x-webfont.woff') format('woff'),
url('fonts/fre3of9x-webfont.ttf') format('truetype'),
url('fonts/fre3of9x-webfont.svg#fre3of9x') format('svg');
font-weight: normal;
font-style: normal;
}

div.barcode {
text-align: center;
background-color: #ffffff;
font-family: 'barcode';
font-size: 5em;
}



HTML:

<div class="barcode">
*@Model.Ssn*
</div>
eo_support
Posted: Wednesday, May 9, 2012 1:40:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi,

We do not support embedded font in CSS. You have to install the font on your system first, and they must be TrueType font.

Another method is to let your barcode library to render it as a plain image (such as .jpg). That way it won't depend on font at all.

Thanks!
donald
Posted: Monday, August 20, 2012 11:14:45 AM
Rank: Newbie
Groups: Member

Joined: 8/16/2012
Posts: 3
eo_support wrote:
We do not support embedded font in CSS. You have to install the font on your system first, and they must be TrueType font.


I am having a similar issue to the OP. If I embed the font on the server generating the report, but keep the @font-face declaration in the CSS so that a user browsing the page will see the appropriate font rendered, will this be okay?
eo_support
Posted: Monday, August 20, 2012 1:20:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Hi Donald,

Yes. You can do that. Just make sure you use the actual font name in the font file. With @font-face, you can name your font-family as anything you want; However once the font is installed on the server, you must use the actual font-family name that font is registered as.

Thanks!
andyadams
Posted: Wednesday, February 25, 2015 11:33:30 PM
Rank: Newbie
Groups: Member

Joined: 2/11/2015
Posts: 3
eo_support wrote:
Hi,

We do not support embedded font in CSS. You have to install the font on your system first, and they must be TrueType font.

Another method is to let your barcode library to render it as a plain image (such as .jpg). That way it won't depend on font at all.

Thanks!

Can you recommend some barcode library to help me do this,i am totally a greenhand in this field.Any suggestion will be appreciated. Thanks in advance.
eo_support
Posted: Thursday, February 26, 2015 9:26:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
andyadams wrote:

Can you recommend some barcode library to help me do this,i am totally a greenhand in this field.Any suggestion will be appreciated. Thanks in advance.


Hi,

We are not familiar with barcode library either. However the previous reply about embedded font is not longer true: we do support embedded font now (only TrueType font).

Thanks!
John King
Posted: Thursday, March 5, 2015 5:51:59 AM
Rank: Newbie
Groups: Member

Joined: 3/5/2015
Posts: 2
I am having the same issue, sometimes the font is there, sometimes it is the backup font (or if I remove the backup font from the css, I get garbage instead). Could it be due to the slight delay while the embedded font is loaded? I've noticed that it can take a fraction of a second to display the custom font, if the PDF engine grabs the html in that time it'll get the backup font instead.
If this is correct, is there any way I can delay the PDF engine to ensure the page is loaded up fully?

For reference, I am embedding the font in this way:


@font-face {
font-family: Changeling;
src: url("changeling.ttf") format('truetype');
}

The font is installed on the server, is also in the directory with the webpages, and UAC is off.
John King
Posted: Thursday, March 5, 2015 10:55:06 AM
Rank: Newbie
Groups: Member

Joined: 3/5/2015
Posts: 2
I've used the MinLoadWaitTime to test this and it seems to be correct, however I've had to set it to 10 second delay to ensure the font loads up. There's probably something amiss with the webpage for it to be that bad. That said it is a fix for the intermittent font rendering issue.
eo_support
Posted: Thursday, March 5, 2015 8:21:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Ed King wrote:
I've used the MinLoadWaitTime to test this and it seems to be correct, however I've had to set it to 10 second delay to ensure the font loads up. There's probably something amiss with the webpage for it to be that bad. That said it is a fix for the intermittent font rendering issue.


Thanks for the update. We will look into this and see if we can find anything.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.