Tuesday, April 22, 2008

There is no such thing as GPL tools or why I love GS

I had had a problem, actually my advisor, to convert a bunch of PDFs to PDFs with embedded fonts. The usual windows approach is to open every single file with Acrobat Professional and embed the fonts. But I found a solution (here). To understand why non-embedded PDFs are a problem is to figure out that for some professional printers (the ones that you find by big publishers) assumes that the PDF has the fonts embedded (so that it does not have to have them installed on the printer). But back to the solution:

INPUT=<file to convert>
OUTPUT= <font embedded file>

gs \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/printer \
-dCompatibilityLevel=1.4 \
-dSubsetFonts=true \
-dEmbedAllFonts=true \
-sOutputFile=${OUTPUT} \
-f ${INPUT}

I left the following options out:


You may also want to change the compatibility parameter to:


To check if the fonts are OK:

pdffonts ${INPUT}
pdffonts ${OUTPUT}

To check if format and such are also OK:

pdfinfo ${INPUT}
pdfinfo ${OUTPUT}

No comments: