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(AbstractSAXPars er
.java:493)
at
org.apache.xerces.impl.XMLNamespaceBinder.characters(XMLNamespaceBinde r.
java:609)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.characters(XMLDTDValidator. ja
va:879)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(XMLD oc
umentFragmentScannerImpl.java:841)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentD is
patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1388)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XML Do
cumentFragmentScannerImpl.java:333)
at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPa rs
erConfiguration.java:529)
at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPa 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 FontFactoryHello, 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 SoaresDoes 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
