So I have some PDFs that I'm using in a web project; we've done this loads of times with a bunch of PDFs, but this is the first time I've run into an issue that we couldn't solve by either editing the PDF or forcing PDFBox to do a bunch of stuff to the files to get them to work. The PDFs in this project all come from different places; some of them are given to us by clients, some of them we built ourselves from scratch using PDFStudio 11, some of them we've been using for years and years and years, and they were originally .jasper files, but we've converted them into standard PDFs and built on them, and some, like the ones causing issues now, were originally Jasper files (I think?) and were converted (Again, I think?) using "iText by lowagie.com (r0.92)", which appears to have come out in 2002...
For some reason, the fonts embedded in these forms are Helvetica, Helvetica, Helvetica-Bold, and... Zapf-Dingbats. And Zapf-Dingbats is the only font with its encoding attribute listed as "built-in"... Every time I try to set a form field in this PDF using PDFBox, it says
> java.lang.IllegalArgumentException: U+0057 ('.notdef') is not available in this font's encoding: built-in (Type 1)
Or U+Whatever-Other-Character-It-Runs-Into, which is... You know, perfectly logical since the only font that gets loaded into the AcroForm by PDFBox is Zapf Dingbats.
I'm really not sure where this thing went wrong; when I first put this PDF together in PDFStudio and added the new form fields so we could use it in the new version of the site, it was working just fine, but for some reason now every time I save it in PDFStudio 11 it reverts all the fonts back to Zapf Dingbats, even if I change them. I have my preferences set to embed fonts, but it just really likes Zapf Dingbats for some reason. I suspect it has something to do with the PDF itself, and not PDFStudio, because we've been using PDFStudio for all our other PDFs and they've been working just fine. My suspicion is that I opened the PDFs to make some small change between now and ~1-2 months ago, and didn't realize that the fonts were messed up, so when it saved that way and became stuck that way, I didn't realize it immediately.
There's 4 PDFs which have this issue; they have about ~110, 80, 50, and 20 fields in them. I've tried optimizing it, and it appears to have just optimized it to have *better* Zapf Dingbats, if it made any changes at all, and I don't really have anything available to me to edit PDFs other than PDFStudio 11... PDFs and the PDF Specification are not really my strong suit; I can make the things from scratch pretty easily, but when I run up against configuration issues, resources/embedded file issues, or any other kind of document properties issues with existing PDFs, or PDFs with unusual formatting, I usually end up having to do a lot of googling, and it doesn't usually turn up many helpful results because I'm not familiar enough with how PDFs are constructed to know exactly which terms to look for. It would take some time to rebuild these by hand, but I would at least know what I was doing if I did it that way.
My question now is; is there any way to get it to stop reverting the fonts back to its favorite font in the world, Zapf Dingbats, and start embedding/using Helvetica (or anything else) again using the tools at hand, or would it potentially be easier to just take the background image out of the original converted PDF and rebuild the form itself from scratch?