Hello, in pdfbox 3.0.0-alpha3 I am encountering the following error: java.lang.NullPointerException: Cannot read the array length because "this.glyphIdToCharacterCode" is null org.apache.fontbox.ttf.CmapSubtable.getCharCode(CmapSubtable.java:638) org.apache.fontbox.ttf.CmapSubtable.getCharCodes(CmapSubtable.java:655) org.apache.pdfbox.pdmodel.font.PDType0Font.toUnicode(PDType0Font.java:546)...
This is thrown by the following code : while (currentPosition < bytes.size && currentCharacterBytes++ < maxEncodingBytes) { potentialCode = potentialCode.shl(8).or(bytes[currentPosition++].toInt().and(0xFF)) val potentialRepresentation: String potentialRepresentation = font.toUnicode(potentialCode) ?: continue // Exception is thrown here unicodeRepresentation.append(potentialRepresentation) codes.add(potentialCode) currentCharacterBytes = 0 potentialCode = 0 } Unfortunately, the pdf that caused this is not available, this error was discovered in review of the logs. Attempts to recreate the exception by creating a pdf through pdfbox and manually using different glyphs/fonts/emoji combinations were unsuccessful. From the exception itself, it would seem that the glyphIdToCharacterCode array in CmapSubtable is not being initialized.