I created a web app that generates pdf documents. The only fonts used are the standard Liberation fonts that are supposed to be embedded in the document. The Liberation fonts are installed on the Centos server that runs the app. I developed the app on a Windows computer. Everything looks great when view the pdf on my Windows computer.
Problem 1. When I download and view the pdf, I get an Adobe Acrobat error saying “The font ‘LiberationSerif’ contains a bad /BBox.” and the formatting is messed up.
Problem 2. If I use Safari on a MacMini M1 to view the pdf, none of the Liberation fonts appear and the few graphics are the only items included on the pdf shown.
The app is presently running on https://ezmeterlynx.com. Click the > button repeatedly until you get to the end.
I found this about the BBox:
Maybe your font is corrupt on your server?
Just to be clear, LiberationSans is not one of the Adobe standard fonts for PDF. They are:
- Times (normal, bold, italic, bold italic) Serif
- Arial (normal, bold, italic, bold italic) Sans-serif
- Courier (normal, bold, italic, bold italic) Monospaced
- Zaph Dingbats
Your system can choose to use other fonts like liberationSans to display a sans-serif font, but you cannot use in a doc and expect the other platforms to know what to do.
I guess Dean is using AddFonts to embed within the document so that they are not required to be installed on the user’s machine in order for the text that uses them to be rendered properly, but maybe not?
Edit: AddFonts also says:
Fonts in your OS font folder may also be used and they will be automatically embedded into the PDF document for you.
Is this not the case for Web apps?
Are the fonts you’re using installed on your server? They should in order to work (and being able to embed them).
Maybe this thread helps you; in this case for installing standard windows fonts on the server (also linux): TextWidth returns 0
I took Javier’s suggestion and changed from Liberation fonts to Windows fonts and everything seems to be working except that I cannot download the pdf after it shows on the screen. If I try to do that, I cannot show a different one one the screen until I start a new session. I’m not surprised at that because the EE-PDF example does the same thing (although it does download).
Greg states that Arial is one of the Adobe standard fonts, yet it does not autocomplete when entering a PDFDocument.StandardFontNames.Is that a bug?
Helvetica is the standard font.
Edit: I found this
- The 14 standard PDF fonts are Courier (Regular, Oblique, Bold, Bold Oblique), Helvetica (Regular, Oblique, Bold, Bold Oblique), Times (Roman, Italic, Bold, Bold Italic), Symbol, and ITC Zapf Dingbats.