Jump to content
JasperReports Library 7.0 is now available ×

PDF Font problem


2004 IR Help

Recommended Posts

By: Ana - ana_abrantes

PDF Font problem

2005-07-12 12:57

I have a report with just one big static text whose height is the same as the detail band.

When I compile and preview inside iReport, it works fine and when I run it from my web application locally, it?s ok too.

But when I deploy to the server, there are some lines missing at the end even with space left, I mean, there?s many blank lines where it was supposed to have the last lines from the static text.

I checked everything that could be different in the 2 environments. The packages (.jar) inside lib are the same, the compile reports (.jasper) are also the same.

The only difference is that my computer is running Windows while the server runs Linux.

Did anyone have this problem ou know how to help me ?

Thanks.

 

 

 

 

By: Ana - ana_abrantes

RE: PDF Font problem

2005-07-13 05:46

Before anyone say to search for the response, I want to say that I've already searched a lot and couldn't find a solution for this problem. I'm using jasperreports 0.6.8, so if this version was supposed to correct this errors, why am I having them yet?

 

 

 

 

By: Teodor Danciu - teodord

RE: PDF Font problem

2005-07-13 06:52

 

Hi,

 

This is caused by the fonts you are using inside your

report template on Windows, but are not installed/available on the Linux machine.

All text size calculations in JR are made using AWT

and when working with PDF you have to make sure that

the pdfFontName attribute points to a font that has the

same properties as the one used by AWT when

calculating size.

 

The best approach is to ship the TTF files with your

application jar files. This way you can make sure these

fonts you are using in your templates are available

on all machines, because you can even install them

on the fly on the target JVM using Font.createFont().

 

Take a look at the supplied "fonts" sample and see how

you could work with TTF files for PDF export.

 

I hope this helps.

Teodor

 

 

 

 

 

By: Darren Davis - ddavis539

RE: PDF Font problem

2005-07-14 21:50

I found that the key to getting fonts to work properly with iReport and on the application server is to do two things:

 

1) Make sure the fonts are in your java classpath. For IReport, this means modifying the start script to include the fonts directory

2) Make sure that the Static Method: FontListLoader.loadTTFFonts(); is called during startup. (iReport already does this, but you need to add it to your server). This is found in the it.businesslogic.ireport.FontListLoader class, so you have to add iReport.jar to the application classpath if it's not already there.

 

Doing this has ensured that the output pdf is consistent when I use TTF fonts. The nice part about this method, is I do not have to embed the PDF fonts into the document to get a consistent result, which is nice when dealing with Asian fonts.

 

 

 

 

By: C-Box - c-box

RE: PDF Font problem

2005-07-14 23:05

I didn't understand why you don't have to embed the fonts relating to Asian fonts.... as a customer of us wants to let produce reports in China that are sent to Germany the font that is used must be included to get a proper pdf output at the other side (to 99,9% the recipient won't have that font installed at his machine). Or did I understood the PDF-Font-Embedding technique wrong?

 

Could you please explain more in detail (as I'm interested in for my future project)

 

tia

C-Box

 

 

 

 

By: Darren Davis - ddavis539

RE: PDF Font problem

2005-07-15 13:00

I've created two different pdf reports. One contains Thai characters and the other contains Korean characters.

 

I use IReport to design the reports, and define report fonts which point to external TTF fonts (that come with Linux). For Thai I'm using Norasi, and for Korea, I'm using Dotum.

 

For both reports I do not check the "include fonts in pdf" checkbox, and I've been able to view the resulting pdf just fine. I've also e-mailed both pdf forms (Thai/Korea) to various users in the US and to both countries and they are able to view the pdf documents using windows or Linux just fine without needing the fonts installed on their system.

 

Because I don't include the fonts, the file sizes of the resulting pdfs are much smaller. For example, the Dotum Korean font is 3MB in size. When I generate a KR pdf without embedding this font, the file size is only 109kb, which is much more efficient for transport and printing.

 

I don't pretend to know how the pdf technology works, but it appears that only the individual characters I actually use are being placed into the pdf as binary font objects. I can possibly create a small sample with a line of Korean and/or thai text if you want to view the resulting pdf.

Link to comment
Share on other sites

  • 3 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

hi all,

 

I have exactly the same issue...

 

So i would like to ask for a simple solution..

 

How could i register my font in the application/jar?

 

I don't want to manually copy the font file to jre folder nor copy to the os font dir.

 

I wanted to ship the font with my application..

 

What i wanted to do is similiar to GraphicsEnvironment.registerFont() in the jdk 1.6 ?

 

thank in advance...

Link to comment
Share on other sites

  • 2 weeks later...

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...