Tuesday, 16 February 2016

Tip : Special character(Square bullet point) of Arial font type is not exported to PDF from Jasper server - How to work around ?

Hi Folks,

There are few reports which needs to exported with special characters, for instance bullet pointed sentences or some descriptions about some project or etc.  stored in data base field(s) as value(s).

See below image, the text with bullet point is coming in java output in Studio and server UI output but not in PDF either in Studio or Jasper server

Problem Statement Images :
Image-1:
Image-2:

Solution
In Studio :
Steps:
1) Import arial.ttf file into Studio.
( * This file can be found in Fonts folder of windows operating system
  * Location : Control Panel\All Control Panel Items\Fonts
  * Copy paste to Arial folder from Fonts into another folder say in your desktop
 * If you wont' copy paste you can't find arial.ttf file but you could see other arial font files). 
 

2)
* Navigate to Window -> Preference  -> Jasper Studio -> Font from Jasper Studio Menu bar.
* Click on Add button -> be in the "Normal" tab and click on "Browse" button to add the arial.ttf
   file from the copied location.

3)  As shown in below 2 images select the text field and go to its properties.
     Check for PDF options and give properties as shown in below text.
    But when taking the arial.ttf file from jasper server you should change the pdfFontName="repo:/yourfontLocationIntheFolders"


<textField>
                <reportElement key="" x="0" y="0" width="555" height="54" uuid="4de18e79-cf3a-44a2-84c8-efb89d4b2f65"/>
                <textElement verticalAlignment="Middle" markup="html">
                    <font fontName="Arial" size="16" pdfFontName="Arial" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{FiledOfSquareShapedSymbolWithText}]]></textFieldExpression>
</textField>




Sample output from Studio when exported to PDF.


 Upload the arial.ttf file in the server as shown in below image : 

I hope this helps someone. !

Thank you for visiting this page. 

Sadakar Pochampalli 

No comments:

Post a Comment