• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfreport pdf unable to find registered ttf font, yet cfimage and cfdocument work (RHEL8)

Participant ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hello all - 

We have recently moved our dev team from our olf CF10 on RHEL6 to CF2021 on RHEL8.  One bit of code we cannot seem to get to function properly is a simple barcode PDF generation.  We have stripped down a test case as barebones as possible and cannot get it to work.  

 

We have the ttf fonts registered in CF administrator (Free 3 of 9 Extended)
We created a very simple CFR file in CF Report Builder, and ticked the box to embed the font
We call the CFR file with <cfreport template="myreport.cfr" format="pdf">

The PDF is generated, however it uses a default font instead of the barcode.

 

If we use the deprecated cfdocument or cfimage tags, the font is happily embedded or renderd, so the font appears to be registered correctly in CF admin.  Also, our cfreport code works fine in CF10.

 

While this simple test would be quite easy to reproduce with an external linunx based PDF generation program, our actual reports are quite complex and would be very time consuming to recreate.

 

We do not see anything pertinent in the log files.   Any suggestions on what might be wrong here?

 

Thanks much,
-Tony

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Mar 18, 2021 Mar 18, 2021

So there appears to be an issue with coldfusion 2021 handing off registered fonts/directories to iText which does the backend PDF generation.  But the problem only exists when invoking iText through cfreport, but oddly not when calling it through cfdocument.   

 

In searching for “itext” within the coldfusion installation dir, it turned up a large changelog document, /opt/ColdFusion2021/cfusion/lib/thirdpartytools/itext_readme.txt. Towards the end of the file, it shows this:

 

Change 76036
add "/usr
...

Votes

Translate

Translate
Participant ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

So there appears to be an issue with coldfusion 2021 handing off registered fonts/directories to iText which does the backend PDF generation.  But the problem only exists when invoking iText through cfreport, but oddly not when calling it through cfdocument.   

 

In searching for “itext” within the coldfusion installation dir, it turned up a large changelog document, /opt/ColdFusion2021/cfusion/lib/thirdpartytools/itext_readme.txt. Towards the end of the file, it shows this:

 

Change 76036
add "/usr/X11R6/lib/X11/fonts/truetype" to one of these directories FontService will automatically scan for fonts on server start.

Edit //depot/ColdFusion/cf_main/tools/itext/src/com/lowagie/text/FontFactory.java#4

598 count += registerDirectory("/usr/openwin/lib/X11/fonts/TrueType");
599 count += registerDirectory("/usr/share/fonts/default/TrueType");
600 count += registerDirectory("/usr/X11R6/lib/X11/fonts/ttf");
+ 601 count += registerDirectory("/usr/X11R6/lib/X11/fonts/truetype");
602 return count;
603 }
604

 

None of those directories exist on the default RHEL8 installation, however creating the directories (or linking to an existing directory) with the fonts inside allows iText to find the font and correctly embed it in the PDF.  We chose to create a symbolic link from the CF Admin registered font directory to one of the directories referenced above.

 

ln -s /usr/share/fonts/ttf /usr/share/fonts/default/TrueType

 

This fixed cfreport's inability to embed (or even specify) fonts in the generated PDF files.

 

Posting the workaround just in case anyone else runs into a similar issue.  Perhaps Ill try to file a bug report and see if anyone is willing to get this fixed in an update.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2021 Mar 21, 2021

Copy link to clipboard

Copied

Hi @GuitsBoy , thanks for sharing that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2021 Mar 21, 2021

Copy link to clipboard

Copied

The bug report.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2021 Apr 12, 2021

Copy link to clipboard

Copied

I have the similar issue but the above soluntion did not work. I need  times-new-roman TTF for my report built in report builder and called by CFREPORT tag. The font is automatically converted to Arial font when exported to PDF or Word. Please help me here with a solution. 

Environment: RHEL 8.2,  Apache 2. 37, CF2021

Thanks 

Ram

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 13, 2021 Apr 13, 2021

Copy link to clipboard

Copied

@R. Ramgopal , add your vote to the  bug report. You will help to get it noticed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

Hi All, 

 

The times new roman font issue is resolved in CF 2021  after copying ttf (true type font) copied to /usr/share/fonts/default/TrueType. First we created the folder /usr/share/fonts/default/TrueType and then copied over the .ttf files. Restarted Linux and CF 2021 Server. 

Usage: CFReport created using CF report Builder (Template) that has the report fields as Times New Roman fonts. This report is generated using the application. The output is PDF Report. Checked the PDF Report in Acrobat DC (Properties) which lists the fonts as Times New Roman. If you have Acrobat DC Pro you can use Edit PDF and view each block that displays the font as Times New Roman. Thanks for the above workaround for this issue. 

You can see in the CFAdmin - Font Management: 

JCC-RRamachand_0-1621018382608.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

LATEST

Also we updated the ColdFusion 2021 JVM (JRE) to 11.0.10. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation