# PDF printer decreases filesize of pdflatex output considerably. Why?

This is probably not exactly a TeX question, but I assume many people concerned with TeX might also have ideas about this issue.

If I compile the following "minimum" example with pdflatex on Windows, the resulting PDF file is 92kb in size. If I then print it to a PDF file (using Acrobat 7), the resulting PDF file is 32kb in size. It looks the same (in particular it is not rasterized). Why is that and more importantly: are there any options I can give to pdflatex to create a file of this smaller size in the first place?

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\begin{document}
\textbf{Ad d}) By the residue theorem we have
\begin{eqnarray*}
\int_{\gamma }f &=& 2\pi i\sum_{z\in C\backslash \left\vert \gamma \right\vert }n(\gamma ,z)\mathop{res}(f,z) \\
&=&2\pi i(n(\gamma ,0)\mathop{res}(f,0)+n(\gamma ,\pi )\mathop{res}(f,\pi )+n(\gamma ,i\pi )\mathop{res}(f,i\pi )) \\
&=&-4ie^{\frac{1}{\pi -i\pi }}\approx 0.74-4.63i
\end{eqnarray*}
\end{document}


edit: I just tried it using the free program pdfcreator, and the size is even reduced to 22kb! Almost all of the size difference is due to the fonts part, as the space auditing of acrobats pdf optimizer tells me. Yet even this optimizer doesn't achieve these large savings, a printing process seems necessary. I wonder why.

-
IMHO it's either a different compression (e.g. enabled by a higher PDF version) or because of fonts. See also How to create small final PDF files for the Internet. – Martin Scharrer Jul 24 '11 at 21:51
On linux, I would use pdffonts to find out what fonts are embedded and whether they are subsetted. Maybe there is something similar that you can do on Windows, e.g., using Adobe Reader? – Ben Crowell Jul 25 '11 at 1:17
I would consider a reprinting in the same format (from PDF via pdflatex to PDF via Acrobat) to be somewhat of an optimization similar to what command line operations like ps2ps attempts to do. The documentation calls it "normalization". I'm also thinking that some packages may add header information (like macros) to an output file, even though they may not always be used in the actual document. During reprinting, these might be stripped, reducing the file size. Font however, as @Martin suggests, also adds to file size. – Werner Jul 25 '11 at 5:45

Software by (Adobe) Acrobat is proprietary, and it would therefore only be speculation as to how/what is employed to obtain smaller file sizes though reprinting. However, there may be some standard techniques to "optimizing" PDF files, as suggested by the manual of QPDF. Although they distinguish between "linearization" and "optimization", I would suggest reading the "richly commented" QPDF_optimization.cc source file for specific techniques used in reprocessing the input PDF.

Edit: Acrobat's utility to "Reduce file size" option gives a broad overview of the types of reductions involved in reproducing a PDF. I would assume that similar optimization may be performed when reprinting an existing PDF. This includes, compression of images, embedded font removal (for standard, well-known/used fonts across platforms), transparency flattening, and others. Perhaps the file reduction stems from removal of items that does not influence functionality.

-
i just let qpdf process the 92kb file, it does not change its size. what options would you suggest? there doesn't seem to be an --optimize option, and --linearize doesn't do anything with regard to size. – peter Jul 25 '11 at 8:39
@peter: Then it may be that there are other optimization techniques (more elaborate) employed by Adobe Acrobat. See my edited post on some of the options to reduce PDF file sizes offered by Acrobat. These may also be at play when reprinting a PDF. – Werner Jul 25 '11 at 14:27