PDF incorrectly generated from JasperViewer

We are using JasperReports for all our reports with PDF as the most commonly used format. In most reports we use different (“non-standard”) font types. In this case we make sure that the plugin is able to find that specific font through the JasperReports directory, defined in the Servoy admin page.

In most cases the PDF report is being generated on the server and therefore these fonts can be found without a problem. But if you are using the SmartClient and show the output in the JasperViewer first and then save it to PDF, an empty file is written. I understand that this is going wrong because the report is generated locally and that particular font cannot be found. However, I have not a clue how to solve this problem.

Is there anyone with some good advice on this one? Thanks…

You need to install the fonts where the client can see them:

1 Install the fonts in a directory of the Servoy web server. ie: /Servoy/application_server/server/webapps/ROOT/fonts.

[attachment=2]fonts.png[/attachment]

2 Create a style for each font. Spedify font name, pdf font name, font style, pdf encoding, and check pdf embedded. The key to making this work is to specify the path to the font on the server in the pdf font name field. Note that you need a pdf font for each font style (bold, italic, etc).

[attachment=1]style1.png[/attachment]

[attachment=0]style2.png[/attachment]

3 Use the “style” property of various report elements to format text instead of using the text properties. You can however specify the “font size” property with a style to override the size of the style.

4 This approach will generally clash if you are using the reportFont tag anywhere in your report (which was deprecated quite a while ago).

5 Remember to find/replace the URL string when switching servers. I haven’t yet figured out how to use a parameter inside of the style tag.