Custom Fonts in Lucee 5


#1

Hi

I am working to migrate a CF9 site to Lucee and decided to go with v5 as
that was on the top of the download page when i started this the other day.

All working pretty well, but have become stuck trying to get custom fonts
to work in <cfdocument>

The steps here for adding custom fonts is for 4.5, and doesn’t seem to
apply for v5

http://dnando.github.io/blog/2015/07/01/generating-accurate-pdfs-using-cfdocument/

A bit of digging around in the v5 install led me to expand the
pdfbox-1.8.9.jar in the pdf-extension-1.0.0.52.lex and package the ttf font
files and reference them in PDFBox_External_Fonts.properties. I then rezip
the lucee.jar and fire up the server, but doesn’t seem to have any effect.

Any one have any luck in getting custom fonts working in v5 yet?

The intent here is to move the site to a Win 2012 server, so i’m not
looking to spend time replacing our cfdocument calls if i can avoid it
right now.

Thanks
Phil


#2

Phil,

Please let us know if / when you find a solution. As I implied in my post,
the process wasn’t at all straightforward, so you may need to fiddle a bit
with names, paths, try a different font package, etc …

Aria Media Sagl


#3

Has anyone found a solution for this?


#4

Hi,

I’ve installed Lucee V5.0.1.48.
I also tried to implement customer fonts on Lucee 5. The only place I found
custom fonts are implemented is the jar-file PDFBox (in L5 it is V0.7.3).
I saw that this jar file is not even loaded (in Lucee-Admin “Bundles”).
Where is it called from?

Best regards - Heinz


#5

No. I had tried for several days to get this working, pulling apart the
lucee install trying to get the fonts in the right location to be picked
up. Unfortunately no luck.

As I was only using them for Barcodes, i gave up and switched to generating
images instead.


#6

I would recommend using wkhtmltopdf over cfdocument or PDFBox in terms of
custom font rendering in PDF.

wkhtmltopdf can handle remotely linked fonts(i.e. Google), CSS-embedded
fonts and local fonts. See the result here:
https://github.com/myleslee/lucee/blob/master/pdf/content.pdf

To me, the biggest advantage of wkhtmltopdf is the capability of rendering
SVG and better support for CSS specs.

Here are some examples produced by wkhtmltopdf (0.12.3):

Source: http://getbootstrap.com/examples/jumbotron-narrow/
Result: https://github.com/myleslee/lucee/blob/master/pdf/bootstrap.pdf

Source: https://www.latex-project.org/
Result: https://github.com/myleslee/lucee/blob/master/pdf/latex.pdf

Using wkhtmltopdf with Lucee is pretty easy. Just install the wkhtmltopdf
binary on the server and use cfexecute to call it.

Here’s a demo to show how custom fonts are rendered by wkhtmltopdf:

You only need:

  • pdf.cfm
  • content.html

Hope this helps.

Da Li


#7

addedly, you can copy your own “fonts.jar” to lucee installation path just
like “opt/lucee/lib” and then restart your lucee server.


#8

Hi,

plz see the

http://www.isummation.com/blog/adding-new-font-to-pdf-using-cfdocument-in-railo/

i hope this help.