While filling a PDF form, i get this exception:
Exception in thread "main" java.lang.NullPointerException
The error comes from the very first widths entry, i.e. charCode is FirstChar (zero). Code lookup gives 65533, which is not in the glyphIndexes table. Maximum code present in glyphIndexes is 65532.
Is there anything I can do to avoid this error? The PDF file with the form that I have to fill comes from outside my company.
Update: there would be the same failure for all characters in range 0-31 and for character 152.
Am also having the same issue with SimpleFont where I have multiple codes not in the glyphIndexes Map. I am trying to render a PDF to an image.
I also stumbled on this NullPointerException while parsing PDFs. I'm using PDF Clown to parse PDFs and to highlight text and my highlighting process always failed when this Exception occured. I got around it by editing the PDF Clown sources, I added a null check on glyphIndexes.get(code) in order to avoid having my highlighting process being disrupted.
if(code != null && glyphIndexes.get(code) != null)
I'm mainly just reading through PDF's so I'm not sure if this happens to have an impact on writing a PDF, but for me at least this does the trick.
Thanks for the great library btw!
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.