Hello Tilman, Thank you for your explanation.
The font can be downloaded under this link: https://www.dafontfree.net/freefonts-ocrb-f151774.htm ORC-B Font is used for Machine Readable Zone text. It contains only Alphabet and numbers. I am using 2.0.19 and by debugging the following line returns NULL OS2WindowsMetricsTable os2 = ttf.getOS2Windows(); Just like you said no os2 table. Regards, Pai On Sun, Jun 14, 2020 at 1:05 AM Tilman Hausherr <thaush...@t-online.de> wrote: > Hi, > > I looked in the source code, and if you're using the latest version > (2.0.20), then > TrueTypeEmbedder:190 > > would mean that the font does not have an OS2 table. Could you please > upload this font somewhere? > > A NullPointerException is of course not nice, I could make a decent > IOException, but you'd still not be able to use this font. > > Tilman > > > Am 13.06.2020 um 18:14 schrieb Pai Peng: > > Hello Apache PDFBox Team, > > > > > > I want to use the font OCR-B for a PDF editing with PDFBox. But I get > > the error by loading this font. > > > > font = PDType0Font.load(pdDocument, new File(fontPath)); > > > > > > java.lang.NullPointerException > > at > > > org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.createFontDescriptor(TrueTypeEmbedder.java:190) > > at > > > org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.<init>(TrueTypeEmbedder.java:83) > > at > > > org.apache.pdfbox.pdmodel.font.PDCIDFontType2Embedder.<init>(PDCIDFontType2Embedder.java:76) > > at > org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:220) > > at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:67) > > > > I think something may be wrong with this font (this font exists under the > > path and is a special font with only some characters.) > > > > Maybe anybody here has met this problem and can share info for me, Thank > You > > > > Regards, > > > > Pai > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org > For additional commands, e-mail: users-h...@pdfbox.apache.org > >