Jump to content

Recommended Posts

Posted
I have tried several tutorials on how to get fonts embedded within PDFs generated by Jasper reports. The tutorials I have used includes the one from the documentation (http://community.jaspersoft.com/wiki/ireport-fonts). No matter what I try I cannot get the font (Times New Roman) to display in the PDF preview.

 

To simplify things I installed a fresh copy of iReports and added the font as the documentation explains. Then I created a simple report with a single field using the new font. The internal preview looks like it should, the PDF export does not. I ensured the "Embed this font in the PDF document" was checked. I also exported the font to a jar and added it to the classpath. None of these attempts have worked. 

 

I have attached two screenshots. The first shows my font settings. The second shows the internal preview and a PDF preview. It also shows the font information dialog from the PDF viewer - my font is not in the list. Any help would be appreciated.

 

My setup:

OS: Ubuntu (latest)

iReport: 5.5.0 with bundled JVM

Font: Times New Roman (TrueType directly from Microsoft)

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I see you are using Ubuntu check this link http://community.jaspersoft.com/wiki/missing-fonts-issue-jasperreports-server-reports-running-ubuntu-server it look slike the JDK that comes with Ubuntu needs the font .jar file in a diferent location.

Some fonts are actually prohibited by their creators from embedding in a PDF. You aren’t doing anything incorrect; the font has been deliberately constructed to prevent PDF embedding. 

Be careful!!! Fonts DO have licenses and you NEED to have a license that enables you to embed them in the PDF and distribute them read the Font's EULA. Times New Roman is © by Monotype. See the links below for more info:

http://www.adobe.com/products/type/font-licensing/font-embedding-permissions.html
http://www.microsoft.com/typography/RedistributionFAQ.mspx
- http://catalog.monotype.com/family/monotype/times-new-roman

Posted

He's just using iReport 5.5.0 which has a bug with adding fonts. I had the same problem. This bug is not in 5.2.0 and is fixed in 5.5.2.

 

Actually wasted half a day on this myself too.

Posted

I ended up solving it and it was not where the fonts were installed, but it was related. Once the font jar that ships with Jasper/iReport (jasperreports-fonts-4.5.0.jar) was loaded, no other font jar (or the internal iReport font manager) could be loaded. I am not sure if it is because there cannot be two jasperreports_extension.properties or just a weird race condition within the JVM.

 

At any rate, I was able to just remove that file and add my own font jar to the classpath. It is not a clean solution, but it works.

Posted
I will give 5.5.2 a try when I get time to switch out my environment. I am sure it will be way more elegant than the solution I found. Thanks!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...