3

The error that I am getting is

2021-05-03 15:00:58.542  WARN 1 --- [nio-8099-exec-1] o.a.pdfbox.pdmodel.font.PDType1Font : Using fallback font Helvetica for ZapfDingbats
2021-05-03 15:00:58.542  WARN 1 --- [nio-8099-exec-1] o.apache.pdfbox.rendering.Type1Glyph2D : No glyph for code 52 (a20) in font ZapfDingbats

Had similar issue with Helvetica, but after reading a response here Pdf to image conversion using PdfBox
I added two missing fonts to /usr/local/fonts

(PDFbox is running on Docker and I am using openjdk:16-jdk-alpine3.12)

Helvetica issue was resolved, but issue with ZapfDingbats still continues.

Any ideas what I am doing wrong?

Cre8or
  • 71
  • 1
  • 8
  • Have you tried to install the ZapfDingbats font? Or Dingbats or MS-Gothic? What PDFBox version are you using? – Tilman Hausherr May 04 '21 at 08:03
  • Yes, I have tried installing ZapfDingbats and MS-Gothic. I have not tried Dingbats. I am using 2.0.23. What Dingbats exact font should I try? – Cre8or May 04 '21 at 15:25
  • It should have the specific postscript names mentioned, that is what counts. Please look into the file `.pdfbox.cache` in your user directory whether the files are there. You can also delete it, it will be regenerated. (should happen automatically if there are new fonts, after a restart of the application) – Tilman Hausherr May 04 '21 at 15:31
  • 1
    Thanks for pointing into .pdfbox.cache. I managed to see what fonts were missing. It seems that in my particular case, when I would create docker container I had to download msttcorefonts-installer and ghostscript-fonts. For those who will get stuck on similar issue just run: apk --update add fontconfig msttcorefonts-installer ghostscript-fonts && \ fc-cache -f -v oh, and if you are running linux, most probably that .pdfbox.cache will be under /root and that file by default is hidden so don't forget to list all (ls -a) – Cre8or May 05 '21 at 12:02
  • If this fixed your problem, please answer this yourself. – Tilman Hausherr May 05 '21 at 15:17

1 Answers1

2

In this particular case, the issue was that Alpine Linux (inside the container) didn't have fonts that I required (Helvetica and ZapfDingbats).

Inside my docker file I had to add

RUN apk --update add fontconfig msttcorefonts-installer ghostscript-fonts  && \
update-ms-fonts && \
fc-cache -f -v

Msttcorefonts would solve my issue with Helvetica font and no glyph error and ghostscript-fonts would install Zapfdingbats.

Cre8or
  • 71
  • 1
  • 8
  • This solution really works. Here is the Git repository where I practiced this solution: https://github.com/chigix/pdfbox/commit/5f0434016eec250faeefce63726c3f3716b47f27#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R7 – 千木郷 May 08 '23 at 16:08