20081106

More PDF font embedding hijinks

I've complained bitterly before about the stupid requirement of many publishers (IEEE, ACM) to embed all fonts in a PDF document -- including the "base fonts", which any compliant reader must be able to render. Because of this, it's actually quite hard to persuade many pieces of software to embed base fonts, because, why would you ever need to do this? This can lead to quite a stalemate, and a lot of frustration.

I had a nice system all working, but in my latest work I've been using Gnuplot with the PDF terminal. This outputs directly to PDF, and avoids a bug in Gnuplot when generating bar charts. All well and good, except that the resultant PDF does not embed the base fonts. And there's virtually no documentation on the Gnuplot PDF terminal, certainly nothing that talks about this.

So, after a lot of frustration and swearing, I came up with the following ugly hack: run the pdf through gnuplot ghostscript with the pre-press option, and output to pdf. Here's the command line I came up with, though it might be more complex than it needs to be:

gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=tmp.pdf -dCompatibilityLevel=1.3 -dPDFSETTINGS=/prepress -c .setpdfwrite -f $1

Where $1 is the name of the input file, and tmp.pdf is the name of the output.

The ironically named "PDF Express" system has yet to verify that the resulting compiled file does the necessary thing, but I'm reasonably confident that it will work now.

3 comments:

Lee Phillips said...

Typo: you mean run through ghostscript. Thanks for figuring this out.

DainDwarf said...

Whoa, great tip. I just got the exact same problem today, and your post just gave me the solution. Thanks a lot! :)

Anonymous said...

Thanks for the tip! It's very helpful.