2

A PDF I generate with jasper reports renders Ok in my MAC but some labels show wrong on Linux. For example, I have a static label that doesn't show completely on linux (only a part of the whole word) but yes on Mac. Can the OS be somehow related? What is the usual source of this kind of problems?

4 Answers4

3

Missing fonts on your linux machine may cause such problems. I had the same when creating pdfs with iText.

Florian Gutmann
  • 2,666
  • 2
  • 20
  • 28
  • But it is not like the whole document can't be seen. Its only one static label that doesn't show the complete text and it also happens that a whole row of the detail section doesn't show up at all. Could this behaviour be still font-related? –  May 05 '10 at 16:07
  • 1
    Yep, I guess it's still font related, sometimes wrong font or wrong font encoding could render the whole report unreadable. For checking, use system fonts that are also compatible with PDF. In the bottom of the Properties of the TextField, there is something called "PDF Encoding", check that as well. – mohdajami May 05 '10 at 16:51
2

Always embed fonts in generated PDFs! It saves you alot of hassles...

And notify the following slight difference: If you create a PDF with Arial as font it shows good in Windows, and will very likely use Helvetica on Linux (which is nearly the same font), but since it has some other metric properties your bounding boxes will not fit.

Again: Always embed fonts in generated PDFs!

Daniel
  • 27,718
  • 20
  • 89
  • 133
  • As long as you don't use a [standard PDF font](http://en.wikipedia.org/wiki/Portable_Document_Format#Standard_Type_1_Fonts). – Florian Jun 20 '11 at 13:12
  • OK. I would embed it anyway, if I have enought space, and where it matters, in case a new version of the font will show different rendering behaviour. – Daniel Jun 20 '11 at 15:21
0

If you have time you can look at Docmosis, it generates PDFs with the fonts embedded, so cross-platform rendering isn't an issue. Beware though if you cross-platform generate doc or odf files, then the fonts will be potentially different showing up in pagination or layout changes. Like has been said above, you need to take care that the destination will have the fonts to display those that were used to generate the document (or embed the fonts if possible).

Paul Jowett
  • 6,513
  • 2
  • 24
  • 19
0

The closes fotn to the PDF Helvetica (SansSerif) is MS Arial.ttf. The problem is that it is not available on the Linux machine by default. Copy it to the /usr/share/fonts (and update fonts.dir) or put it to your Linux JRE installation to fonts/ directory (and update fonts.dir). If you do not want to use MS Arial, try GNU FreeFont http://ftp.gnu.org/gnu/freefont/

You can embed the fonts in the PDF as Daniel has adviced, but it makes PDF larger.

xmedeko
  • 7,336
  • 6
  • 55
  • 85