cfdocument with custom fonts

842 views
Skip to first unread message

Igal

unread,
Dec 16, 2011, 5:56:38 PM12/16/11
to ra...@googlegroups.com
hi,

I'm trying to use a custom font in a pdf.

for the purpose of testing, I installed a font called "Garamond" on the machine, the TTF file is in "C:\WINDOWS\Fonts\GARA.TTF"

the pdf is a simple file to test the font, but it does not render the font properly.

any ideas?

TIA

sample code below:


<cfdocument format="PDF" fontEmbed="true">

<!DOCTYPE html>
<head>
<style>
h1 { font-family: Arial; }
.verdana { font-family: verdana; }
.garamond { font-family: Garamond; }
.undefined { font-family: undefined123; }

.left { text-align: left; }
.right { text-align: right; }
.center { text-align: center; }
</style>
</head>

<h1>Test @ Arial</h1>
<h1 class="verdana">Test @ Verdana</h1>
<h1 class="undefined">Test @ Undefined</h1>

<h1 class="garamond" style="font-family:Garamond;">Test @ Garamond</h1>
<h3 class="garamond left">Test @ Garamond</h3>
<h3 class="garamond center">Test @ Garamond Centered</h3>
<h3 class="garamond right">Test @ Garamond Right</h3>

</html>

</cfdocument>


Terry Bankert

unread,
Dec 16, 2011, 9:23:03 PM12/16/11
to ra...@googlegroups.com

You could try using @fontface in your css

Igal

unread,
Dec 18, 2011, 11:44:15 PM12/18/11
to ra...@googlegroups.com
hi, thanks for your response, I'm sure there's a simpler way though (and pretty sure that the parser that converts html to pdf is not css3 compliant).  

I've seen other messages of people who have done it so I'm not sure what I'm doing wrong.

if anyone has managed it I'd love to hear what's wrong with my code.

thank you.

Michael Offner

unread,
Dec 19, 2011, 3:37:08 AM12/19/11
to ra...@googlegroups.com

Igal

unread,
Dec 19, 2011, 12:05:02 PM12/19/11
to ra...@googlegroups.com
thanks Michael,

I saw this when I was trying to research the issue before I posted my question here.  

the name of the font I'm testing with is "Garamond", so it's a single word with no spaces.  according to Russ he resolved the issue once he removed the spaces from the font names so I'm not sure what I'm doing wrong.

should it be as simple dropping the font file in the system's font folder?  can you tell me which library is used to generated the pdf?  maybe I can research in that direction.

thank you.



On Monday, December 19, 2011 12:37:08 AM UTC-8, Michael Offner wrote:
FYI:

/micha

2011/12/19 Igal <d...@21solutions.net>
hi, thanks for your response, I'm sure there's a simpler way though (and pretty sure that the parser that converts html to pdf is not css3 compliant).  

I've seen other messages of people who have done it so I'm not sure what I'm doing wrong.

if anyone has managed it I'd love to hear what's wrong with my code.

thank you.


On Friday, December 16, 2011 6:23:03 PM UTC-8, tbankert wrote:

You could try using @fontface in your css

Peter Boughton

unread,
Dec 19, 2011, 12:56:34 PM12/19/11
to ra...@googlegroups.com
Are you *sure* the full name of the font is "Garamond"?

It's entirely possible it is "ITC Garamond" or "URW Garamond" or
"Original Garamond" or "Adobe Garamond Pro" or plenty of others
variations... http://new.myfonts.com/search/name:garamond/fonts/

To find out the full name, execute the TTF to get the font display
thing, and verify what it says there.

Igal

unread,
Dec 19, 2011, 1:15:32 PM12/19/11
to ra...@googlegroups.com
hi Peter,

yes, I am sure.  I am using the basic Garamond (as opposed to other variations that are available).  opening the font file it says:

Garamnod (OpenType)
OpenType Font, Digitally Signed, TrueType Outlines
Typeface name: Garamond

the same code works properly with ACF 8, i.e. ACF generates a PDF that renders the font properly.

I wonder if Russ or Den can provide some feedback on this.  I've noticed from older posts that they are familiar with the subject.

thank you.

Igal

unread,
Dec 19, 2011, 8:44:47 PM12/19/11
to ra...@googlegroups.com
ok, I resolved it by adding the font to {railo-server}\WEB-INF\lib\fonts.jar and adding an entry for the font in the properties file there.

thank you for your ideas.

Paul Klinkenberg

unread,
Jan 14, 2012, 4:36:49 PM1/14/12
to Railo
Even though it's a month later now, I wanted to let you know that
there is an extension by Denny Valliant with which you can add the
fonts to the jar file:
http://www.getrailo.org/index.cfm/extensions/browse-extensions/cfdocfonts/

Kind regards,

Paul Klinkenberg

Igal

unread,
Jan 14, 2012, 5:13:53 PM1/14/12
to ra...@googlegroups.com
hi Paul,

thanks for your reply.  I actually found Denny's extension back then but I had a hard time setting it up.  I ended up looking at what it did and thus figured out the solution that I posted above.

thanks again.
Reply all
Reply to author
Forward
0 new messages