There are a number of tricks for getting optimized pdfs. Many of them are implemented in the tool pdfsizeopt. With some patches (posted in the pdfsizeopt bugtracker) this tool can run on all my tex-generated pdfs (and nearly all of the non-tex-generated ones). I use the commandline:
python ./pdfsizeopt.py --use-pngout=true --use-jbig2=true --use-multivalent=true --do-unify-fonts=false filetocompress.pdf
I use --do-unify-fonts=false
even though it produces slightly larger pdfs, because of a bug where a few glyphs are not displayed with certain pdf viewers (windows adobe reader, for example).
There are indeed various things you can do during document production with tex, to make sure that the compressed pdf ends up as small as possible: several of these are discussed in the EuroTeX 2009 White paper about pdfsizeopt (available at https://github.com/pts/pdfsizeopt/releases/download/docs-v1/pts_pdfsizeopt2009.psom.pdf).
As regards fonts, pdfsizeopt will recode fonts to the very compressed CFF format, and take care of subsetting and duplication issues. I haven't investigated deeply, but in my tests it seems that of the 2 options for type 1 encoded T1 (multilingual) tex fonts, the Latin Modern fonts generally produce significantly larger PDFs than the CM-Super version (which is unfortunate, because Latin Modern is superior in just about every other way (see this question). I just did a quick experiment and this difference in size seems to be only for the pre-pdfsizeopt pdfs: after pdfsizeopt, Latin Modern is the same or smaller than CM-Super.
Using fonts that don't have optical scaling will indeed produce a smaller PDF, but I don't recommend it because if you are using multiple sizes then the non-optically scaled fonts will look much worse.
Okay jumping on the old horse! ;-)
Meanwhile Acrobat Reader X offers some simple possibilities for PDF annotations. If you want to do more you can use the pdfcomment
package, e.g. for your examples:
\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[rgb]{xcolor}
\usepackage[author={Max Schlepzig}]{pdfcomment}
\begin{document}
Here we\pdfcomment[color=red,icon=Insert]{insert: miss} a word!
You can do much more \pdfmarkupcomment[markup=Squiggly,color=green]{with pdfcomment}{move to the front}.
This is a \pdfmarkupcomment[markup=StrikeOut,color=red]{stupid}{replace stupid with funny} game!
\pdfmarkupcomment[markup=Highlight,color=yellow]{Of course, you can highlight complete sentences.}{Highlight}
This is very\pdfcomment[icon=Note,color=blue]{insert graphic!} interesting!
\end{document}
Best Answer
A common approach is to let Ghostscript (
gs
) optimize and compress the PDF after it has been created withpdflatex
.Ghostscript is installed by most Linux distributions and easily available for other platforms (Windows as binaries, MacOS via MacPorts). In fact, almost all size-optimizing tools for PDF (save for Acrobat) you can find on the internet, internally use Ghostscript -- so you can as well call it directly.
There is a plethora of options available; I personally use the following:
I use this mostly for beamer presentations, where it gets me a size reduction of 60–70 percent. (A 10 MiB lecture note becomes 3–4 MiB in size.)
Edit 2020-02-06: Added
-dPrinted=false
to preserve Hyperlinks.Edit 2020-09-10: Changed
-dCompatibilityLevel
from 1.4 to 1.5 aspdflatex
outputs PDF 1.5 by default since 2010.