On Mark's advice I downloaded the source code from the 5.0.2 branch
and dug a little deeper...

The NPE is thrown on the following line of the DocumentFont constructor.

fontName = PdfName.decodeName(font.getAsName(PdfName.BASEFONT).toString());

It turns out that font.getAsName(PdfName.BASEFONT) returns null.

font, which is a PdfDictionary, has the following values in its hash map...

{/FontBBox=[-2, -9, 38, 40], /LastChar=121, /FontMatrix=[0.240000, 0,
0, 0.240000, 0, 0], /Type=/Font, /Resources=Dictionary, /CharProcs=134
0 R, /Encoding=72 0 R, /Subtype=/Type3, /Name=/C0HN2000T1X005000,
/Widths=135 0 R, /FirstChar=32}

You'll notice that there is no key for /BaseFont.

I'm not sure I can post the whole pdf to a public news group... I will
see if I can cut it down to a page or so of none sensitive data first.

Ben


On 16 June 2010 16:31, Kevin Day <ke...@trumpetinc.com> wrote:
>
> I will add to Mark's (excellent) stream of consciousness analysis:
>
> The next step is to see what the name of the font resource is that is
> causing the problem.  Then, load RUPS and dig into the page dictionary and
> find the entry for that font resource - given what Mark is showing in the
> source, most likely the font resource isn't defined.
>
> There's always a question with this sort of thing about 'why does Acrobat
> show the file OK' - the answer is that Acrobat is very permissive - there
> are all sorts of problems like this that it may silently ignore.  Older
> versions of Acrobat often show problems that newer versions ignore.
>
> And then, of course, there's always the possibility that there's a problem
> with iText, and the strategy for looking up font resources isn't quite in
> sync with the PDF spec.  I don't *think* that is the case here, but it's
> always possible.
>
> If you do wind up providing the PDF so we can take a look, be sure to also
> provide font file that think may be involved.
>
> - K
> --
> View this message in context: 
> http://itext-general.2136553.n4.nabble.com/NPE-while-Extracting-text-tp2256512p2257485.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.itextpdf.com/book/
> Check the site with examples before you ask questions: 
> http://www.1t3xt.info/examples/
> You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to