Embedding fonts in jasper reports

As it’s not guaranteed that all users have the same set of fonts, it’s a good idea to embed these fonts into the created PDF-Files, especially if it’s a more or less exotic font. The following example will quickly show the few steps required to accomplish this task.

Registering the font(s)

Basically all you need to do is to create two configuration files. The first is the jasper_extension.properties in the root directory of your java source. This file will point to the actual XML-File registering the desired fonts.

Next we have to register the actual font and reference the actual True-Type-Fonts. The most important part here, of course, is to let jasper know that the font has to be embedded into the PDF-File.

Using the font in the report

Now we have registered a font in jasper, we just need to reference it within the actual report.

Finally generate the report. No special setup required here.

Example Code

References

4 thoughts on “Embedding fonts in jasper reports”

    1. Please explain your problem more detailed. I currently don’t see a reason for images with a coding problem. 😀

  1. Lightray Solutions stand as typically the pinnacle oof buziness and technology consulting, revered for it is unwavering
    commitment to excellence and innovation. Renowned becauise of its unequalled expertise,
    Lightray Alternatives empowers organizations to be able
    to transcenhd their issues and achieve outstanding success.
    Which has a dedicated tem off futurist consultants, they build bespoke strategies that will propel businesses forwards
    in a qyickly evolving landscape.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.