Wednesday, May 13, 2009

Embedding fonts to pdf files....

.. can be painful. I've needed to do this twice, and both times it has been equally oppressive. First time, for my submission to ICALT 2009, I used pdflatex. This however, requires that you won't use eps figures and this can be sometimes impossible (especially if you have used massive amount of eps figures), and generally I just don't like pdflatex that much.

Today, it seems I found a way to embed fonts to latex based pdf files by using the latex->dvips ->ps2pdf way. So, this is what I did (and believe me, it took plenty of time to figure out):

1. I've been using these three command in my preamble. Have no idea why, but there they have been (most likely some of them are from the original template I've been using (phd thesis template of dept of CS)).
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}

2. Now, I found a link which pointed out that unicode might be the problem here... thus,

3. I commented fontenc and amsfonts away.... then

4. dvitops, and then

5. using this mighty spell, I got finally all the fonts embedded to the pdf file:
ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true mainofficial.ps

(obviously, you need to change the mainofficial.ps to yourfilename if you're willing to give this a try)

Again, I don't understand all of this, but it does the trick and I'm happy with it. Now, using pdffonts and acroreads document properties it can be confirmed that all fonts are indeed embedded. Excellent. Now I can read my phd thesis with zoom levels such as 2400% and still have nice and clear fonts... what could be better than that??

No comments: