Re: [Retep-PDF] (no subject)
Status: Beta
Brought to you by:
petermount
From: Peter M. <pe...@re...> - 2004-09-11 09:26:14
|
Howard, Jeffery wrote: >Hi, > >I've been attempting to use retep-pdf (v2.4.1) as a print service under Java 1.4.2 and I've run into a bit of a problem. >For what I'm doing with this program I need to be able to represent a hierarchy of objects (using a JTree in the GUI). I've extended the JTree to make it printable and it prints beautifully to a real printer so I'm confident that my code is correct. >Things turn sour very quickly as soon as I try to use retep-pdf to generate a PDF of the report. I get a NullPointerException from retep-pdf. I've included the stack trace below. > > [snip] >java.lang.NullPointerException > at java.io.Reader.<init>(Reader.java:61) > at java.io.InputStreamReader.<init>(InputStreamReader.java:55) > at uk.org.retep.pdf.util.afm.AFM.<init>(AFM.java:92) > at uk.org.retep.pdf.util.afm.BaseMetrics.getFont(BaseMetrics.java:100) > at uk.org.retep.pdf.core.GraphicsImpl.getFontMetrics(GraphicsImpl.java:999) > at uk.org.retep.pdf.core.GraphicsImpl.getFontMetrics(GraphicsImpl.java:983) > > Ok, this one appears once every so often, and it's caused by the font name being passed from Swing not being recognised. The BaseMetric's class is used to load in the font metrics for the base fonts that are guaranteed to exist in a PDF viewer (we can't use awt's font metrics for several reasons, mainly because the values differ on each platform java runs on). Can you tell me which font's you are using within your GUI? What I've done in the past is add the differing font names into a map and associate it with the appropriate base font. Peter |