How can I display "$ £ Ω € απ⅔" in Jasperserver PDF using iReport?

I hardcoded a text box with a value

":$£Ω€απ⅔:" 

to check if these characters will be displayed in PDF

But it only prints as

 :$£€: 

I tried changing the font to "Symbol", but that does not do the trick.

Note: I am using iReport 5.5

+5
special-characters jasper-reports export-to-pdf
Nov 26 '15 at 13:37
source share
3 answers

I tried using your characters using font-extensions in iReport. These are the steps that I have taken.

  • Download (or use one on your computer) your desired ttf font (it must support characters), I used dejavu-serif .
  • Install the font in iReport or in Jasper soft studio (click on the link to understand how)

    • I used iReport 5.6 and installed PDF encoding: Idenity-H (Unicode with horizontal recording) and embedded the font in pdf format. That was the code of my textField

       <textField> <reportElement x="8" y="15" width="100" height="20" uuid="41dc1200-091f-4799-a1d2-4622f88a0e84"/> <textElement> <font fontName="DejaVu Serif" size="13"/> </textElement> <textFieldExpression><![CDATA[":$£Ω€απ⅔:"]]></textFieldExpression> </textField> 
  • Export the font extension (this creates a .jar)

  • Add a jar to your class path.
  • Export to pdf and get the result.

Result

This is an example of using any arbitrary font, if you want to use DejaVu Sans or DejaVu Serif , you can just include the jasper fonts library in the classpath, so these fonts are already included and displayed in the library

+14
Nov 26 '15 at 14:28
source share
— -
 JRDesignStyle normalStyle = new JRDesignStyle(); normalStyle.setName("tahoma"); normalStyle.setDefault(true); normalStyle.setFontName("../tahoma_0.ttf"); normalStyle.setPdfFontName("../tahoma_0.ttf"); normalStyle.setPdfEncoding("Identity-H"); normalStyle.setPdfEmbedded(true); . . jasperPrint.addStyle(normalStyle); 
+1
Feb 25 '16 at 9:04
source share

I posted a similar question and the above technique solved my problem until one day I restarted the JasperServer context. I tried to get the message "PDF encoding not found" when I tried to export the report to pdf.

To solve this problem, I had to copy iText-Asian.jar and Font-extension.jar to the lib folder of the jasperserver context. "JasperServer / WEB-INF / Lib". After that, restart the context and fix the problem.

Hope this helps someone.

+1
Mar 08 '16 at 11:48
source share



All Articles