Jump to content
Changes to the Jaspersoft community edition download ×

Not getting the required Fonts in PDF


chidamparam

Recommended Posts

 Platfprm: JBOSS/JSP

iReport designer 4.0.2

issue: Using ireport designer 4.0.2 created design with text fields formatted to "Verdana font". With ireport preview in PDF format getting the required Font with BOLD letters.

When I am calling the above jasper from java application also getting the required fonts.

But when I call the above jasper from JBOSS/JSP to fill and then to Export to PDF, it is getting exported and getting the report in PDF but not getting the required fonts and Bold letter, Also getting the following exception:

12:52:40,796 ERROR [DefaultExtensionsRegistry] Error instantiating extensions registry for fonts

java.lang.NullPointerException

                at net.sf.jasperreports.engine.fonts.SimpleFontFace.<init>(SimpleFontFace.java:83)

                at net.sf.jasperreports.engine.fonts.SimpleFontFamily.createFontFace(SimpleFontFamily.java:316)

                at net.sf.jasperreports.engine.fonts.SimpleFontFamily.setItalic(SimpleFontFamily.java:101)

                at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamily(SimpleFontExtensionHelper.java:241)

                at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamilies(SimpleFontExtensionHelper.java:204)

                at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:173)

                at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:142)

                at net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory.createRegistry(SimpleFontExtensionsRegistryFactory.java:63)

                at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.instantiateRegistry(DefaultExtensionsRegistry.java:238)

                at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistries(DefaultExtensionsRegistry.java:213)

                at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistries(DefaultExtensionsRegistry.java:162)

                at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getRegistries(DefaultExtensionsRegistry.java:132)

                at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:104)

                at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:81)

                at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:182)

                at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)

                at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:87)

                at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)

 

Tried by copying the Fonts in the lib folder but could not resolve. need help to resolve the above issue

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

 

We have identified the FONT problem while exporting to PDF and resolved. As many are facing the above issue, let me provide the solution in detail.

1. Open ireport

2. Go to "Tools", select "Options"

3. ireport will open a page with "iReport", "general", "Editor", etc.,

4. select "iReport", it will have "General", "classpath", "Fonts" etc.,

5. select "Fonts"

6. It will list the following installed default fonts, "Dejavu Sans", "Dejavu Sans Mono", "Dejavu Serif", etc.,

7. Also you can find "Install Fonts" button on the Right hand side

8. If you want to add any other Font other than from the above list, for example "verdana" then click on "Install fonts"

9. It is menu driven, "Browse" and select the Required Fonts from "Windows" ---> "Fonts" folder

10. Also select the BOLD and Italics fonts if required.

with the above steps required fonts will get installed in ireport.

11. In ireport designer select the Text Field for which you want to specify the font(e.g Verdana)

12. Goto properties,  select the property "Font name", choose the Font from the drop down list. It should list the alreasdy installed Font(Verdana)

13. Select the size,Bold, Italic etc.,

14. Also choose "PDF Embedded"

Compile and Preview. With this you are able to choose the required Font and its characteristics Bold, italic etc.,

15. Now comes to configure JASPER for the required Fonts. JASPER has configured for the default Fonts as per point 6. We need to add the additional Fonts and follow the procedure described below.

16. Goto JASPER/jasperreports-4.0.2/dist, you will find a jar "jasperreports-fonts-4.0.2"

17. unjar/extract it

18. you will find net/sf/jasperreports/fonts/ with a folder for Fonts and and a fonts.xml file

19. edit the above xml file and add the required font

20. Also add the Required Font ttf in the above path or the path you define in the xml

21. jar it and deploy.

That's all, with the above steps you will get the required fonts.

You can reach me through mail at chidamparamm@yahoo.com for clarification on the above subject.   

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...