PDF generated with jasperreport not showing well on Linux but yes on Mac, could the os be related?

蹲街弑〆低调 提交于 2020-01-14 02:06:25

问题


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?


回答1:


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




回答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!




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/2774789/pdf-generated-with-jasperreport-not-showing-well-on-linux-but-yes-on-mac-could

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!