cfdocument: font not rendering
Copy link to clipboard
Copied
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">
@Blissful_help0D4E-face
{font-family:"Cambsdfria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@Blissful_help0D4E-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@Blissful_help0D4E-face
{font-family:"Gotham XNarrow Bold";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@Blissful_help0D4E-face
{font-family:"Gotham XNarrow Book";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@Blissful_help0D4E-face
{font-family:"Gotham XNarrow Black";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@Blissful_help0D4E-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%;}
@page 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>
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
The fonts are installed and they show properly when I don't use the
cfdocument tag.
..Robert
Copy link to clipboard
Copied
I should have added that they are installed properly on the server and
they show through CF Admin on the server.
..R
Copy link to clipboard
Copied
Acrobat Reader will lists the fonts that are contained in a PDF
document (File > Properties > Fonts). Is there any trace of the font
you want in that list, or is it missing? If the font is in the list is
there a note next to the name saying "embedded?"
-Mike Chabot
Copy link to clipboard
Copied
There are just two fonts listed in the pdf: both are times roman.
I guess that means it doesn't even see the fonts I want to use and is
substituting with common fonts, but the fonts I want to use are showing
in CF Admin.
Is there some way of forcing them to be seen by CFDOCUMENT, I wonder?
..Robert
Copy link to clipboard
Copied
Maybe try the basic HTML font tag instead of style sheets to see if
that helps with the font embedding.
-Mike Chabot

Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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.

