Home
> JasperReports > Embedding fonts into PDF generated by JasperReports
Embedding fonts into PDF generated by JasperReports
This post has moved here: http://javaskeleton.blogspot.com/2010/12/embedding-fonts-into-pdf-generated-by.html
Categories: JasperReports
Tags: Arial, bold, embedded, font, iReport, JasperReports, PDF
Leave a comment Cancel reply
Recent Posts
- Switching between PayPal live and test environments
- Preventing multiple form submits in ICEFaces by disabling commandButton
- Avoiding the “javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed” error
- ICEFaces 2.0 charts migration
- Embedding fonts into PDF generated by JasperReports
- PayPal Mass Payments using HttpClient 4
- Slow ICEFaces
- Avoiding the “javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated” with HttpClient
- Setting the notifyURL for the PayPal IPN
- PayPal Instant Payment Notification (IPN) Servlet with HttpClient 4
Good article. I think font extensions are not understood or used as well as they should be, so it’s nice to see things like this.
By the way, there is no “s” in iReport.
Thanks. I checked your blog and it looks really good. I see you already did an article on this subject (for the JasperReports server) yourself. People interested in JasperReports should defenately check his blog at https://mdahlman.wordpress.com/!
Thanks, that article saved my day! I was searching arround for days and did not find a suitable solution to this Problem. I could not beleive that a Report tool like Jasper cannot handle bold fonts.
Hi Christoph,
As you can see Jasper Reports can handle bold fonts, you just have to know how to configure it :-). That’s the main problem with Jasper Reports: the documentation. There is the ultimate guide that’s very good, but unfortunately it’s not free. If you don’t use Jasper Reports commercially you’re on your own.
Thanks a lot. I finally made it work!
I have tried both methods, but they are only applicable if you are using Java 1.5 while I am using Java 1.4. Do we have other way to resolve this issue?
Hi Andy,
First of all I would definitely recommend upgrading to a newer java version: 1.4 is starting to get pretty old. I suppose you don’t have a choice or you would already have done so.
Can you tell me exactly which part doesn’t work on java 1.4? Is it the font extension, iReport, JasperReport…? You could try mapping the fonts directly in your report xml file, as follows:
<font fontName=”My Font” ispdfembedded=”true”
pdffontname=”path/to/myfont.ttf”/>
I haven’t tried this though, so I don’t know if it will work…
Hi,
I have created the fonts jar file and kept in the classpath.
After this do we need to do any changes in the jrxml file like setting “PDFembedded = true”..please clarify
Regards,
Hema
Hi,
You don’t have to modify your jrxml file if you use the font extension, that was the old approach. The new approach is to use the font extension. All you have to do is make sure that the font name used in your jrxml file is the same as the one you define in the fontfamily.xml file.
hi,
my concern is how can we make sure that the jasper report is using the fonts from fonts jar file or from windows/unix environment.
Please clarify..
Thanks in advance,
Hema.
Hi,
Jasper reports will not pick up the fonts from the windows/unix environment. This is the reason you need the font extension. iReport DOES pick up the fonts from the OS, and that’s the reason your report looks ok in iReport but not in JasperReport.
In the fonts.jar file is a file called jasperreports_extension.properties. Jasper reports will automatically pick up this file and read it out. It will the find your font definition file (the fontfamily.xml file or whatever you called it) and get the fonts from that file. It will all be automatic, all you need to do is add the jar file to your classpath.