Add new font for cfdocument


currently I have a barcode font, but when I print as pdf with cfdocument the font is not change. In coldfusion we can add the font at font folder. How we do it in lucee?

I read in some forum, we can do it with updating the fonts.jar in /lucee/lib folder. But I cannot find it fonts.jar in that folder, anyone know about this ?



This discussion might help…


i have the same problem… i want to add barcode fonts to custom fonts… i’ve added the ttf files to fonts.jar and added font name in

i have tried several times like below :

  • added fonts.jar in folder /srv/apps/lucee/lib/ ( folder lib that contains "lucee-5.X.X.XXX.jar), after that i cannot start my lucee in my vagrant… i have to delete this file then i can restart lucee successfully.

  • added fonts.jar in opt/lucee/lib folder (previously this folder doesn’t exist) and nothing happens

  • added Code39.ttf, code39u.ttf and IDAutomationHC39M.ttf in /srv/apps/lucee/jdk/jre/jre/lib/fonts/ folder (in this folder contains ttf font files). after that i cannot start my lucee properly until delete those files.

  • added fonts.jar in /srv/apps/lucee/tomcat/lucee-server/bundles/ folder (in this folder contains a lot of jars, so i think i can include fonts.jar in this folder), but still doesn’t work…

  • Finally, i tried to add fonts.jar in WEB-INF/lucee/lib/ folder in my vagrant installation and fonts.jar was loaded in WEB-INF/lucee/logs/application.log… but still i cannot use custom fonts…

is there any way that i missed, using wrong method, placing fonts.jar in wrong folder, or anything? i’m really confused why it still won’t show…


We gave up on using fonts to create barcodes and create images using ZXing instead. You include the zxing files (core-3.1.0.jar and javase-3.1.0.jar in our case, which can be found at and in [lucee]/tomcat/lib, then the following code will produce a barcode:

<cfset format=createObject('java','')>
<cfset writer=createObject('java','').init()>
<cfset matrix=createObject('java','')>
<cfset output="My Barcode">
<cfset barcode=writer.encode(output,format.CODE_128,75,75)>
<cfset image=ImageNew(matrix.toBufferedImage(barcode))>

Put the relevant text in the ‘output’ variable and fiddle with the parameters in the ‘barcode’ variable to adjust the barcode to your needs.



thank you for the suggestion… i tried this method and successful…

but the problem is, my custom fonts aren’t barcodes only… i have several fonts like verdana, gothic and other fonts that not included in lucee…

this is really frustating just to add custom fonts… in coldfusion, adding custom fonts is really simple… :confused:


load font style on tag html

body {font-family:"Code39",IDAutomationHC39M; font-size:12px;}


it still won’t work… i also try to show it in cfm, not in cfdocument but also doesn’t work… is there anyone have a clue what is wrong with it? i really need to use custom fonts and it kinda frustating that it won’t work at all… :frowning:

here is my example code to test custom font

	document name="pdfOutput" format="PDF" pageType="A4" marginBottom="0.1" marginLeft="1.5" marginRight="1.5" marginTop="0.2" unit="cm" {
			<style type="text/css">
				p.barcode, h3.barcode {font-family:"Code39",IDAutomationHC39M; font-size:12px;}
			<p>Barcode Custom Font Test:</p>
			<h3 class="barcode">1234567890</h3>
			<p class="barcode">1234567890</p>
	header name="Content-Disposition" value="inline; filename=test.pdf";
	content reset="true" type="application/pdf" variable="pdfOutput";


after copy file font, did you restart your lucee?


of course i have… i even restart my vagrant for this… but still no result…


I just had a long custom font loading fight with lucee too. We’re deployed on PaaS, so we can’t touch the fonts.jar file, or any of the java folders or libraries.

What we needed to do is pass the java launch some JAVA_OPTS. Here’s the JAVA_OPTS we used…


We just put the ttf files in that directory and java picked up on them and loaded them. You need to restart your java engine for this to take effect.


I’m really thank you for your reply and information… but i not familiar about JAVA_OPTS…

where do we add the “Dsun.java2d.fontpath” path?

from your example path given, are you using windows? do you know where do we add it in linux?

i’m using vagrant and linux as the OS for my virtualization…


It is an argument passed into java when you launch your j2ee server. Where and how you specify that is probably unique to your environment.

For me - I’m using Azure Webapps - so I can just put it in the environment variable in the setup (method 2)

You will need to find where/how you pass in arguments to java when it launches your Tomcat (or whatever J2EE server you are running).

(The more I think about it, the more I think that JAVA_OPTS is just the method that Azure uses. You will probably want to search for adding java arguments to the command line)


What if you’re using cfimage?