Use an absolute path to the font and an alias to make sure you call the
right name. If you don't give an alias the font name will be the internal
postscript name that may not be what you expect.
In windows it throws the exception with Sun's JDK 1.3.1, 1.4.0 and 1.4.1.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Bendik R.Johansen [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, February 06, 2003 17:10
> To:   [EMAIL PROTECTED]
> Subject:      Re: [iText-questions] NullPointerException with FontFactory
> 
> Thanks!
> That got rid of the NullPointerException. Howerver, I did not get the  
> fonts to display, but I will have another go at it later.
> 
> I am using Java 1.3.1 on Mac Os X
> 
> On torsdag, feb 6, 2003, at 17:37 Europe/Oslo, Paulo Soares wrote:
> 
> > Download http://itext.sourceforge.net/downloads/iTextAsian.jar and put  
> > it in
> > your classpath.
> > By the way, what OS and JDK are you using?
> >
> > Best Regards,
> > Paulo Soares
> >
> >> -----Original Message-----
> >> From:      Bendik R.Johansen [SMTP:[EMAIL PROTECTED]]
> >> Sent:      Thursday, February 06, 2003 16:25
> >> To:        [EMAIL PROTECTED]
> >> Subject:   Re: [iText-questions] NullPointerException with FontFactory
> >>
> >> Thanks,
> >> I am not able to catch this exception either.
> >> Is there any other way to accomplish this?
> >> It seems to work sometimes, with type 1 fonts, but not when using
> >> FontFactory.
> >>
> >> On torsdag, feb 6, 2003, at 16:26 Europe/Oslo, Paulo Soares wrote:
> >>
> >>> The exception has nothing to do with FontFactory. It's being thrown  
> >>> in
> >>> CJKFont in this static block:
> >>>
> >>>     static {
> >>>         try {
> >>>             InputStream is = getResourceStream(RESOURCE_PATH +
> >>> "cjkfonts.properties");
> >>>             cjkFonts.load(is); // problem here
> >>>             is.close();
> >>>             is = getResourceStream(RESOURCE_PATH +
> >>> "cjkencodings.properties");
> >>>             cjkEncodings.load(is);
> >>>             is.close();
> >>>         }
> >>>         catch (Exception e) { // should be caught here
> >>>             cjkFonts = new Properties();
> >>>             cjkEncodings = new Properties();
> >>>         }
> >>>     }
> >>>
> >>> I don't know why the catch block is not working, that's a problem  
> >>> from
> >>> your
> >>> side. You may be using an IDE that is configured to catch all the
> >>> exception
> >>> while debugging.
> >>>
> >>> Best Regards,
> >>> Paulo Soares
> >>>
> >>>> -----Original Message-----
> >>>> From:    Bendik R.Johansen [SMTP:[EMAIL PROTECTED]]
> >>>> Sent:    Thursday, February 06, 2003 14:15
> >>>> To:      [EMAIL PROTECTED]
> >>>> Subject: Re: [iText-questions] NullPointerException with FontFactory
> >>>>
> >>>> Here is the Stack trace. I have have tried with absolute paths too,
> >>>> but
> >>>> it did not work either.
> >>>>
> >>>> java.lang.NullPointerException
> >>>>          at java.io.Reader.<init>(Reader.java:59)
> >>>>          at
> >>>> java.io.InputStreamReader.<init>(InputStreamReader.java:84)
> >>>>          at
> >>>> java.io.InputStreamReader.<init>(InputStreamReader.java:73)
> >>>>          at java.util.Properties.load(Properties.java:184)
> >>>>          at com.lowagie.text.pdf.CJKFont.<clinit>(CJKFont.java:84)
> >>>>          at
> >>>> com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:356)
> >>>>          at
> >>>> com.lowagie.text.FontFactory.register(FontFactory.java:492)
> >>>>          at
> >>>> com.lowagie.text.FontFactory.register(FontFactory.java:479)
> >>>>          at PDFDocument.addText(PDFDocument.java:79)
> >>>>          at XML2PDF.blockContent(XML2PDF.java:126)
> >>>>          at XML2PDF.characters(XML2PDF.java:57)
> >>>>          at
> >>>> org.apache.xerces.parsers.AbstractSAXParser.characters(AbstractSAXPa 
> >>>> rs
> >>>> er
> >>>> .java:493)
> >>>>          at
> >>>> org.apache.xerces.impl.XMLNamespaceBinder.characters(XMLNamespaceBin 
> >>>> de
> >>>> r.
> >>>> java:609)
> >>>>          at
> >>>> org.apache.xerces.impl.dtd.XMLDTDValidator.characters(XMLDTDValidato 
> >>>> r.
> >>>> ja
> >>>> va:879)
> >>>>          at
> >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(XM 
> >>>> LD
> >>>> oc
> >>>> umentFragmentScannerImpl.java:841)
> >>>>          at
> >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentConten 
> >>>> tD
> >>>> is
> >>>> patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1388)
> >>>>          at
> >>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(X 
> >>>> ML
> >>>> Do
> >>>> cumentFragmentScannerImpl.java:333)
> >>>>          at
> >>>> org.apache.xerces.parsers.StandardParserConfiguration.parse(Standard 
> >>>> Pa
> >>>> rs
> >>>> erConfiguration.java:529)
> >>>>          at
> >>>> org.apache.xerces.parsers.StandardParserConfiguration.parse(Standard 
> >>>> Pa
> >>>> rs
> >>>> erConfiguration.java:585)
> >>>>          at
> >>>> org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
> >>>>          at
> >>>> org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser. 
> >>>> ja
> >>>> va
> >>>> :1148)
> >>>>          at XML2PDF.parse(XML2PDF.java:134)
> >>>>          at Converter.convert(pdfServer.java:160)
> >>>>          at pdfRequestHandler.createPdf(pdfServer.java:138)
> >>>>          at pdfRequestHandler.run(pdfServer.java:98)
> >>>>          at java.lang.Thread.run(Thread.java:491)
> >>>> On torsdag, feb 6, 2003, at 11:51 Europe/Oslo, Paulo Soares wrote:
> >>>>
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From:  Bendik R.Johansen [SMTP:[EMAIL PROTECTED]]
> >>>>>> Sent:  Thursday, February 06, 2003 6:47
> >>>>>> To:    [EMAIL PROTECTED]
> >>>>>> Subject:       [iText-questions] NullPointerException with
> FontFactory
> >>>>>>
> >>>>>> Hello,
> >>>>>> Iget a NullPointerException  when i try to register � new font wit
> >>>>>> FontFactory
> >>>>>> code:
> >>>>>> FontFactory.register("../fonts/edmunds.ttf");
> >>>>>>
> >>>>>         And the stack trace is?
> >>>>>
> >>>>>> The font is in that location, I am absolutely sure :)
> >>>>>>
> >>>>>         No you are not, not with relative paths.
> >>>>>
> >>>>>> What I am trying to achieve, is to write a specific piece of text,
> >>>>>> with
> >>>>>> a certain font, at a fixed place on the page.
> >>>>>> code:
> >>>>>> Font font = FontFactory.getFont("Edmunds", BaseFont.WINANSI, 12);
> >>>>>> this.writeHandle.beginText();
> >>>>>> this.writeHandle.setFontAndSize(font.getBaseFont(), fontSize);
> >>>>>> this.writeHandle.showTextAligned(align, text,
> >>>>>> millimetersToPoints(x),
> >>>>>> millimetersToPoints(y), 0);
> >>>>>> this.writeHandle.endText();
> >>>>>>
> >>>>>> This works.. kind of. The pdf gets written, but the fonts look
> >>>>>> nothing
> >>>>>> like they are supposed to (It's basically Helvetica squeezed
> >>>>>> together)
> >>>>>>
> >>>>>         If the font is not found then Helvetica is returned. If it's
> >>>>> squeezed together that's because you have some transformation  
> >>>>> before.
> >>>>>
> >>>>>         Best Regards,
> >>>>>         Paulo Soares
> >>>>>
> >>>>>> Does anyone have any ideas?
> >>>>>>
> >>>>>> Thanks
> >>>>>>
> >>>>>>
> >>>>>> -------------------------------------------------------
> >>>>>> This SF.NET email is sponsored by:
> >>>>>> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2  
> >>>>>> See!
> >>>>>> http://www.vasoftware.com
> >>>>>> _______________________________________________
> >>>>>> iText-questions mailing list
> >>>>>> [EMAIL PROTECTED]
> >>>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>>>>
> >>>>>
> >>>>> -------------------------------------------------------
> >>>>> This SF.NET email is sponsored by:
> >>>>> SourceForge Enterprise Edition + IBM + LinuxWorld  Something 2 See!
> >>>>> http://www.vasoftware.com
> >>>>> _______________________________________________
> >>>>> iText-questions mailing list
> >>>>> [EMAIL PROTECTED]
> >>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>>>
> >>>>
> >>>>
> >>>> -------------------------------------------------------
> >>>> This SF.NET email is sponsored by:
> >>>> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> >>>> http://www.vasoftware.com
> >>>> _______________________________________________
> >>>> iText-questions mailing list
> >>>> [EMAIL PROTECTED]
> >>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>>
> >>>
> >>> -------------------------------------------------------
> >>> This SF.NET email is sponsored by:
> >>> SourceForge Enterprise Edition + IBM + LinuxWorld  Something 2 See!
> >>> http://www.vasoftware.com
> >>> _______________________________________________
> >>> iText-questions mailing list
> >>> [EMAIL PROTECTED]
> >>> https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>
> >>
> >>
> >> -------------------------------------------------------
> >> This SF.NET email is sponsored by:
> >> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> >> http://www.vasoftware.com
> >> _______________________________________________
> >> iText-questions mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > http://www.vasoftware.com
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to