Hi guys, I have a simple PDFBox application that takes a text string and inserts it into every page of a PDF file. It is based on the AddMessageToEachPage.java code in the example given.
I'm having an issue where I am getting a ClassCastException on CMapParser.java:137. I can see and debug the error, but I don't know why it would be doing this and I'm not sure what to do. Here is the source code: https://gist.github.com/leonardteo/3b8567e7f747ef640b70 The error is happening on line 93: contentStream.setFont( font, fontSize ); It works on many PDF's but there are enough of these errors that it is causing problems with our users. Any ideas what I'm doing wrong? Thanks, Leo java.lang.ClassCastException: org.apache.fontbox.cmap.CMapParser$Operator cannot be cast to java.lang.Number at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:137) at org.apache.pdfbox.pdmodel.font.PDFont.parseCmap(PDFont.java:602) at org.apache.pdfbox.pdmodel.font.PDSimpleFont.extractToUnicodeEncoding(PDSimpleFont.java:454) at org.apache.pdfbox.pdmodel.font.PDSimpleFont.determineEncoding(PDSimpleFont.java:422) at org.apache.pdfbox.pdmodel.font.PDType1Font.determineEncoding(PDType1Font.java:269) at org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:194) at org.apache.pdfbox.pdmodel.font.PDSimpleFont.<init>(PDSimpleFont.java:84) at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:152) at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:88) at org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:187) at org.apache.pdfbox.pdmodel.PDResources.addFont(PDResources.java:518) at org.apache.pdfbox.pdmodel.edit.PDPageContentStream.setFont(PDPageContentStream.java:308) at PDFStamper.stamp(PDFStamper.java:96) at PDFStamper.main(PDFStamper.java:128)

