Jump to content
Changes to the Jaspersoft community edition download ×

Embedding Type1 fonts in PDF documents

Recommended Posts

By: Thomas Heinen - theinen

Embedding Type1 fonts in PDF documents

2003-10-15 05:51

Hi Teodor.


I noticed, that it is not possible to embed type1 fonts in PDF documents. I analyzed the source code and found out, that you only pass the afm-part of the font to BaseFont.createFont. For Type1-fonts you have to pass the pfb-part of the font instead of "null".


Therefore I propose this patch for the class JRPdfExporter, which is working well for me:



patched jasper-reports-version, it now can also embed type1-fonts, which wasn't possible before:



in class dori.jasper.engine.export.JRPdfExporter

in method exportText


at line 1097 added declaration to other declarations:


byte[] pfbbytes = null;


at line 1107 added after try-segment for loading the font:




n = jrFont.getPdfFontName();

if (n.substring(n.length()-3).equals("afm"))


loc=n.substring(0,n.length()-3) + "pfb";

pfbbytes = JRLoader.loadBytesFromLocation(loc);



pfbbytes = null;


catch(JRException e)


throw new JRException("Could not load pfb-font from location :

" + loc);



after that changed creation of BaseFont-object ('pfbbytes' was 'null' before):


baseFont =










I hope I could help with my patch ;-)



Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...