PDF incorrectly generated from JasperViewer

Questions and answers on developing, deploying and using plugins and JavaBeans

PDF incorrectly generated from JasperViewer

Postby vincentSchuurhof » Thu Apr 15, 2010 2:54 pm

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...
vincentSchuurhof
 
Posts: 26
Joined: Fri Aug 21, 2009 12:39 pm

Re: PDF incorrectly generated from JasperViewer

Postby david » Sat Apr 17, 2010 12:26 am

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.

fonts.png
font directory
fonts.png (29.54 KiB) Viewed 4687 times


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

style1.png
iReport style font setup
style1.png (54.35 KiB) Viewed 4687 times


style2.png
Source representation of a style
style2.png (17.53 KiB) Viewed 4686 times


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.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 5 guests

cron