Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF on Linux: Combine font subsets and replace Type 3 with Type 1

I have a PDF file that I'd like to post-process on Linux. In particular I'd like to:

  • Replace Type 3 fonts with Type 1 fonts
  • Replace multiple subsets of the same font with a single subsets (the subsets are the result of including figures in LaTeX, where each figure contains a subset'ed font)

With Windows these two steps are possible with the Adobe Distiller (open the document file and print it into a new PDF document with the respective settings).

On Linux I'm able to subset fonts with Ghostscript [1], but it does not seem to be able to replace (all?) Type 3 fonts with Type 1 fonts or to combine multiple subsets of the same font.

Any hints on how I can achieve these two tasks with free tools?

(I am aware of the reply to How to convert Type 3 font to Type 1 font in PDF. However, I don't really care if I theoretically lose information about the font, as this conversation seems to work fine in Distiller).


[1] With the arguments:

gs -dPDFA -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH \
   -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
   -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 \
   -dMaxSubsetPct=100 -dSubsetFonts=true \
   -dEmbedAllFonts=true -sOutputFile=/tmp/tmp.pdf -f "$1"
like image 329
steve20 Avatar asked Sep 05 '10 21:09

steve20


1 Answers

Somehow I doubt your statement "With Windows these two steps are possible with the Adobe Distiller". I'd need to see with my own eyes that this works before I can believe it. This is especially true for the "replace multiple subsets of the same font with a single subsets". (But I'm not in a position to verify or falsify the statement myself right now... so I'll just take it for a fact for the time being.)

Type 3 fonts are described in a fully-fledged version of PostScript. Type 1 fonts are described by using a subset of the PostScript language.

Replacements of embedded fonts are a non-trivial task when processing PDF files. I'm not familiar with any Ghostscript-related utility that could do that.

callassoftware.com has a very powerful commandline utility for sale called pdfToolbox CLI 4. It is available for Windows, Linux, Mac OS X and Solaris. pdfToolbox4 is capable of achieving practically everything you can imagine in so-called PDF preflighting jobs. This includes un-embedding of font subsets and re-embedding them again with their full sets (do it in 2 separate steps, so it might produce the result you want).

That's about the only tool I can think of which could help you. (BTW, a part of callas' PDF preflighting technology is licensed by Adobe to pose in Acrobat 9 Pro as its own preflighting tool...)

like image 66
Kurt Pfeifle Avatar answered Nov 10 '22 04:11

Kurt Pfeifle