Skip to main content
Participating Frequently
September 26, 2010
Question

cfdocument: font not rendering

  • September 26, 2010
  • 2 replies
  • 10270 views

Hi: I have a webpage that prints a photo with text underneath that is in specific fonts.

This works fine when it is rendered as a normal webpage: the fonts display exactly as they should, but when I wrap the code with a CFDOCUMENT tage the fonts revert to standard fonts i.e., the wrong donts.

I'm tearing my hair out. Does anyone have any ideas?

thanks.

..Robert

Here's the code:


<cfdocument format="pdf" fontembed="yes" filename="aaa.pdf"  overwrite="true">

<?xml version="1.0″ encoding="UTF-8″?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML-document</title>

<meta http-equiv=Content-Type content="text/html; charset=windows-1252" />
<meta name=Generator content="Microsoft Word 12 (filtered)" />
<style type="text/css">

@11220649-face
    {font-family:"Cambsdfria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
@11220649-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
@11220649-face
    {font-family:"Gotham XNarrow Bold";
    panose-1:0 0 0 0 0 0 0 0 0 0;}
@11220649-face
    {font-family:"Gotham XNarrow Book";
    panose-1:0 0 0 0 0 0 0 0 0 0;}
@11220649-face
    {font-family:"Gotham XNarrow Black";
    panose-1:0 0 0 0 0 0 0 0 0 0;}
@11220649-face
    {font-family:AngssdfanaUPC;
    panose-1:2 2 6 3 5 4 5 2 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin-top:0cm;
    margin-right:0cm;
    margin-bottom:10.0pt;
    margin-left:0cm;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calsdfibri","sans-serif";}
.MsoPapDefault
    {margin-bottom:10.0pt;
    line-height:115%;}
@4025150 WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
    {page:WordSection1;}

</style>

</head>

<body lang=EN-CA>

<table width="155" border="0" cellpadding="0" cellspacing="0">

<tr>
    <td align="center" width="144" height="77" colspan="3"><!img src="052498.jpg" WIDTH="144" HEIGHT="77" border="0" />
    <embed width="144" height="100" src="W1936758.tif" type="image/tiff" /></td>
</tr>

<tr>
    <td width="3"></td>
    <td align="center" width="138" height="11"><span style='font-size:9pt;font-family:"Gotham XNarrow Bold"'>14 First Street</span></td>
    <td width="3"></td>
</tr>

<tr>
    <td width="3"></td>
    <td align="center" width="138" height="11"><span style='font-size:11pt;font-family:"Gotham XNarrow Black"'>$599,900</span></td>
    <td width="3"></td>
</tr>

<tr>
    <td width="3"></td>
    <td align="center" width="138" height="11"><span style='font-size:9pt;font-family:"Gotham XNarrow Book"'>145 sq ft, two-storey, 3 bedrooms, 2 baths, full fin basement, more details to come.</span></td>
    <td width="3"></td>
</tr>

<tr>
    <td width="3"></td>
    <td align="center" width="138" height="11"><span style='font-size:9pt;font-family:"Gotham XNarrow Bold"'>Mark Jones</span></td>
    <td width="3"></td>
</tr>

<tr>
    <td width="3"></td>
    <td align="center" width="138" height="11"><span style='font-size:9pt;font-family:"Gotham XNarrow Bold"'><em>Realty Office</em></span></td>
    <td width="3"></td>
</tr>

</table>

</body>
</html>

</cfdocument>

This topic has been closed for replies.

2 replies

October 27, 2010

Hi,

Is it possible to embed fonts from an external source into cfdocument?  For example, I have tried the following but it didn't work.

<cfdocument fontembed="yes" format="pdf">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">

</head>

<body>

<div style="font-family:'Tangerine';">Testing 123</div>

</body>
</html>
</cfdocument>

Owainnorth
Inspiring
November 25, 2010

I may be wrong, but we had a similar issue recently - try playing around with how you name the font in your CSS going into cfdocument. In CF Admin under Font Management each font has three names - "Font Family", "Font Face" and "Postscript Name" - I believe if you're using the wrong one in your CSS then it won't embed properly.

Might not be the fix, but it's a simple one to test.

Inspiring
September 27, 2010

Is the font installed on the server, or only on your computer? If you

want CF to embed a font, the CF server needs to have access to the

font. Check CFAdmin for a list of fonts that ColdFusion knows about.

-Mike Chabot

bcreedyAuthor
Participating Frequently
September 27, 2010

The fonts are installed and they show properly when I don't use the

cfdocument tag.

..Robert