Jump to content
We've recently updated our Privacy Statement, available here ×

Helvetica.afm exists but not found


ktrinad

Recommended Posts

By: John Pollard - johnnypoll

Helvetica.afm exists but not found

2004-01-02 10:55

Hi,

I recently upgraded to jasper 0.5.0 and itext 0.96.

 

When attempting to generate a PDF file I now get:

 

Helvetica not found as resource. (The *.afm files must exist as resources in the package com.lowagie.text.pdf.fonts)

ExceptionConverter: com.lowagie.text.DocumentException: Helvetica not found as resource. (The *.afm files must exist as resources in the package com.lowagie.text.pdf.fonts)

at com.lowagie.text.pdf.Type1Font.<init>(Unknown Source)

at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)

at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)

at com.lowagie.text.pdf.PdfChunk.<init>(Unknown Source)

at com.lowagie.text.pdf.ColumnText.addText(Unknown Source)

at com.lowagie.text.pdf.ColumnText.setSimpleColumn(Unknown Source)

at dori.jasper.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:326)

at dori.jasper.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:228)

at dori.jasper.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:187)

at dori.jasper.engine.JasperPrintManager.printReportToPdf(JasperPrintManager.java:151)

at dori.jasper.engine.JasperManager.printReportToPdf(JasperManager.java:394)

 

The file Helvetica.afm does exist in the fonts directory of the itext jar mentioned.

 

Previously I was running with jasper 0.4.1 and itext 0.92 and didn't have

this problem. My app is deployed via Java Web Start. I believe there is something about the way resources are loaded that if failing.

 

Thanks

John

 

 

By: John Pollard - johnnypoll

RE: Helvetica.afm exists but not found

2004-01-03 12:42

I stumbled across the answer which is to ensure that any package from which resources need to be loaded also contains at least one java class file that is loaded into the application before any of the resources are accessed. So in my case I created an empty class called ResourceAnchor.class, patched it into com.lowagie.text.pdf.fonts within the itext jar and made sure I created an object of that class near the start of my app.

If anyone can tell me why this works I'd love to know. Something to do with the fact the itext jar is deployed via Java Web Start I believe.

 

 

By: Paulo Soares - psoares33

RE: Helvetica.afm exists but not found

2004-01-05 05:50

I'll include a dummy class in any package that has only resources in the next version of iText, just in case.

The java class loaders work in mysterious ways and so do the application servers. The Oracle AS is paradigmatic: the behavior depends on the java version and whether iText is inside a jar or expanded to a directory.

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