Cannot see CALIBRI font in PDF

0

Hi all,

I need to print PDF report from jasper server but I can't see the font chosen.

I set CALIBRI and all works fine in Design environment, when I try to print it in PDF the font disappears.

Could you tell me the steps I have to do to perform this action, please?

thanks in advance, Michele

michele.cucci's picture
Joined: Jan 8 2014 - 1:40am
Last seen: 4 years 11 months ago

6 Answers:

0

Hi.

You have to embeed all the fonts in you application.

To do so you can add them at Ireport and export a .jar file.

("iReport - Tools - Options - Fonts - Export as extension")

 

Now include this jar file in your project!

gabwdias's picture
Joined: Nov 25 2014 - 5:53am
Last seen: 4 years 12 months ago

I have already tried this solution, the jar (with calibri) is correctly added in classpath of iReport and the font Calibri is already installed.

michele.cucci - 4 years 12 months ago
0

The font is probably not on the Server where you are running the report.  There is a section on handling fonts in the user documentation for Studio.  You may beed a font jar, which is loaded to the server.  Your report runs with the correct font in development because the font is likely on your laptop or desktop.

H Mendoza's picture
351
Joined: Feb 20 2013 - 11:39am
Last seen: 5 months 1 week ago

No, because I run the development in the same server in which I run the PDF output.
How can I solve this?

michele.cucci - 4 years 12 months ago
0

Is there a step by step tutorials to add Fonts in jasper server? I found many guides on this in the web, but NO ONE solved my problem.

It's unbelievable that Jasper cannot provide a set of fonts embedded on its softwares. mah...

 

michele.cucci's picture
Joined: Jan 8 2014 - 1:40am
Last seen: 4 years 11 months ago

See Chapter 8 of the iReport Ultimate Guide, most recent version.

H Mendoza - 4 years 12 months ago
1
Hi guys, I'm having the same problem with font embed in PDF.
I have done all the steps to add a font in pdf.
 
(Source / Preferences / Fonts / Add) and added the jar generated in the application path. And nothing worked.
 
I defined the size font to 24, but when I've printed in pdf, the size font is 10.
Could someone help me with this, because the various tutorials of the internet has not worked.
 
Thank you.
 
Att
 
Astork
astork's picture
12
Joined: May 3 2011 - 2:36pm
Last seen: 4 years 4 months ago
0

Sub-Report fonts not working - FIXED

I have a groovy/grails application from which I call my .jrxml files to render jasper reports.  Thse do not need to be compiled, but any reports having a sub-report MUST have the sub-report component compiled to a .jasper which is referenced from my applicatoin and called at runtime.

The font related issue I have been experiencing is that wherever I have called a pre-compiled sub-report, the fonts I use do not appear in either the right fontface, size or bold/italic - I simply lose control over the font altogether.  This has been with only the sub-report component of the whole report, the main report produces exactly as expected.

After searching the web, and the Japser comminity for 18 months, and trying the font import /export to .jar and import into my grails app, nothing worked.  I tried all of the suggested methods of adding each font as a .jar file, butn nothing seemed to work for me.

 

Finally, I upgraded the version of the jasper plugin I was using in my grails app, and instantly, the font issues vanished and the whole report was finally being rendered correctly, pre-compiled sub-reports and all!  The whole thing was finally playing ball.  That's after 18 months.

 

This fixed it!

Previosuly I had the following line in my BuildConfig.groovy file

compile ":jasper:1.8.0"

but when I changed it to the most recent version and re-compiled my project, all of the font face/size issues simply dissappeared.

 Here's my plugin line now.

compile "org.grails.plugins:jasper:1.11.0"

 

I sure hope this saves someone else from having to serach the web for 18 months.

 

Regards,

 

Icy

Ivan.Hibbert's picture
Joined: Aug 19 2014 - 8:04pm
Last seen: 1 year 1 week ago
0

EDIT to above post:  It seems as though my efforts (from the post above) were only a partial fix for the whole font issue.  It turns out that the true fix was to take the latest version of jasperreports-fonts-6.2.2.jar and unpack it (can be done by changing the .jar to .zip).

 

Once unpacked, I could edit the jasperreports_extension.properties to include new fontfaces I planned to add, following THIS example.  I also had to copy in the new font files and update the fonts.xml to include the new fonts and reference them, but that was a  simple copy and paste of a previous fontFamily and edit the fields.

 

Once saved, I could re-package the jar file with my own name (I used the java jar command jar -cfM myFonts.jar .)

 

With my new myFonts.jar in my grails lib directory, all fonts behaved as planned, including italic, bold and bold-italic.  Any fonts I reference in my jrxml which were not present, defaulted to a plain Helvetica.

 

Below is the resluting files.

jasperreports_extension.properties:

net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.dejavu=net/sf/jasperreports/fonts/fonts.xml
net.sf.jasperreports.extension.simple.font.families.arial=net/sf/jasperreports/fonts/fonts.xml
net.sf.jasperreports.extension.simple.font.families.timesnewroman=net/sf/jasperreports/fonts/fonts.xml

 

fonts.xml:

<?xml version="1.0" encoding="UTF-8"?>

<fontFamilies>

    <fontFamily name="Times New Roman">
        <normal>net/sf/jasperreports/fonts/timesnewroman/times.ttf</normal>
        <bold>net/sf/jasperreports/fonts/timesnewroman/timesbd.ttf</bold>
        <italic>net/sf/jasperreports/fonts/timesnewroman/timesi.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/timesnewroman/timesbi.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'Times New Roman', Arial, Helvetica, sans-serif</export>
            <export key="net.sf.jasperreports.xhtml">'Times New Roman', Arial, Helvetica, sans-serif</export>
        </exportFonts>
        <!--
        <locales>
            <locale>en_US</locale>
            <locale>de_DE</locale>
        </locales>
        -->
    </fontFamily>

    <fontFamily name="Arial">
        <normal>net/sf/jasperreports/fonts/arial/arial.ttf</normal>
        <bold>net/sf/jasperreports/fonts/arial/arialbd.ttf</bold>
        <italic>net/sf/jasperreports/fonts/arial/ariali.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/arial/arialbi.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'Arial', Arial, Helvetica, sans-serif</export>
            <export key="net.sf.jasperreports.xhtml">'Arial', Arial, Helvetica, sans-serif</export>
        </exportFonts>
        <!--
        <locales>
            <locale>en_US</locale>
            <locale>de_DE</locale>
        </locales>
        -->
    </fontFamily>
    
    <fontFamily name="DejaVu Sans">
        <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSans.ttf</normal>
        <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Bold.ttf</bold>
        <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Oblique.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-BoldOblique.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
        </exportFonts>
        <!--
        <locales>
            <locale>en_US</locale>
            <locale>de_DE</locale>
        </locales>
        -->
    </fontFamily>

    <fontFamily name="DejaVu Serif">
        <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSerif.ttf</normal>
        <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Bold.ttf</bold>
        <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Italic.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-BoldItalic.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Serif', 'Times New Roman', Times, serif</export>
        </exportFonts>
    </fontFamily>

    <fontFamily name="DejaVu Sans Mono">
        <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono.ttf</normal>
        <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-Bold.ttf</bold>
        <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-Oblique.ttf</italic>
        <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf</boldItalic>
        <pdfEncoding>Identity-H</pdfEncoding>
        <pdfEmbedded>true</pdfEmbedded>
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export>
        </exportFonts>
    </fontFamily>

    <!--
        Mapping Java logical fonts, for the sake of HTML export only.
    -->
    
    <fontFamily name="SansSerif">
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Sans', Arial, Helvetica, sans-serif</export>
        </exportFonts>
    </fontFamily>
    <fontFamily name="Serif">
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Serif', 'Times New Roman', Times, serif</export>
        </exportFonts>
    </fontFamily>
    <fontFamily name="Monospaced">
        <exportFonts>
            <export key="net.sf.jasperreports.html">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export>
            <export key="net.sf.jasperreports.xhtml">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export>
        </exportFonts>
    </fontFamily>

</fontFamilies>

 

Maybe THIS post will save someone a heap of trouble.

 

Kind reagards,

Icy

Ivan.Hibbert's picture
Joined: Aug 19 2014 - 8:04pm
Last seen: 1 year 1 week ago
Feedback
randomness