Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed @font-face fonts when Printing to PDF with Chrome

I have a page that I'm rendering only in Chrome with a bunch of custom fonts:

@font-face{ font-family: BodyFont; src: url('fonts/font.ttf'); }

The browser renders everything perfectly. However, when I try to print this to PDF, there are two issues:

  1. Chrome's Print-Preview sometimes does not display text in some fonts, or mangles it. This view is passed on to whatever printing device I use. Closing/re-opening the tab does not change the preview. However, restarting the browser does.

  2. No matter what I do, I can't produce a PDF with the fonts embedded. I have tried Chrome's "Save to PDF", which produces a PDF that Adobe Acrobat cannot open. A variety of PDF Printers (such as Adobe's) do not produce PDFs with these fonts embedded, even though replacing the @font-faces with standard web fonts does produce embedded fonts.

Any help with either issue is appreciated.

like image 382
Vanwaril Avatar asked Jul 22 '12 23:07

Vanwaril


People also ask

How do I print a PDF with embedded fonts?

To embed the fonts that are not already embedded, go to File > Print. Bring up the Adobe PDF settings and properties, then Adobe PDF settings. Embed your font. Edit the default settings and navigate to Font, click the Embed all fonts option.

How do I fix PDF fonts not embedded in a PDF?

In Acrobat Pro, Tools > Print Production > Preflight > expand “PDF Fixups” > select “Embed Fonts” > click “Analyze and fix”.

Why are fonts not embedded in PDF?

When a font cannot be embedded because of the font vendor's settings, and someone that opens or prints the PDF does not have access to the original font, a Multiple Master typeface is temporarily substituted–AdobeSerifMM for a missing serif font, and AdobeSansMM for a missing sans serif font.


1 Answers

Comment out media query in CSS or HTML, re-open browser and it would load the web font in print-preview, then, re-add media query section, and it works.

I found this workaround from here:@font-face embedded fonts do not show up in a print preview

like image 68
floydwch Avatar answered Sep 17 '22 21:09

floydwch