Assume I have a screenshot in png format and make a copy of it in eps format by using ImageMagick.

I create two input file, namely ForPNG.tex and ForEPS.tex. ForPNG.tex imports the png image and is compiled by pdflatex. ForEPS.tex imports the eps image and is compiled by latex-dvips-ps2pdf.

The question is, which one produces the smaller pdf file in size?

In my experience, ForEPS.pdf will be smaller than ForPNG.pdf. But I am not sure whether it is a summary.

  • 4
    This does not answer the actual question, so I post it as a comment: Actually, both approaches are not particularly good in producing small PDF files. If you aim at a small PDF, I suggest to compress the resulting PDF afterwards (e.g., using gs as suggested in How to make the PDFs produced by pdflatex smaller). I am pretty sure that any significant difference between both routes basically disappears after gs-compression. – Daniel Jun 5 '11 at 14:49
  • Another route: Use something other than .png. It's a screen capture, so do you really need every bit preserved? Convert the .png file to a .jpg file using some graphics converter program. It's fairly easy to reduce the size of a typical screen shot by 2/3 or even more without too much loss of quality. – David Hammen Jun 5 '11 at 19:24
  • 1
    There is a python-script called pdfsizeopt.py, code.google.com/p/pdfsizeopt which reduces the size of pdfs. I use it frequently, but with texlive 2010 you need to begin your *.tex-file with \pdfminorversion4 – Keks Dose Jun 5 '11 at 19:55
  • @xport: Should I turn it into a real answer then? – Daniel Jun 5 '11 at 22:26

Despite my comment to the original question, I have now come to the conclusion that the latex-dvips-ps2pdf route produces smaller PDF files than pdflatex alone.

However, in my answer to How to make the PDFS produced by pdflatex smaller I suggested to use gs to compress the resulting PDF, which gets you a significant reduction in size. As ps2pdf is as well built on gs internally, one can also directly pass compression options to ps2pdf, so in the end it should not matter.

I made some quick experiments with a beamer presentation. In these experiments the pdflatex-gs route lead to only 1 percent smaller PDFs than latex-dvips-ps2pdf.

So the bottom line is: With respect to the goal of small PDF files, it doesn't matter.

You can just choose your frontend depending on other constraints (e.g., latex-dvips-ps2pdf if you use pstricks or pdflatex-gs to support transparencies in pgf/tikz images).

  • PDF produced by latex->dvips->ps2pdf->gs is smaller than one produced by pdflatex->gs. – xport Jul 9 '11 at 14:48

This whitepaper contains extensive discussion about the pros and cons of different ways of generating small PDFs from TeX, including pdftex, or tex-dvips-ps2pdf, or dvipdfm, or dvipdfmx. With and without subsequent size optimization using several tools (alone and in combination): ps2psdf, pdf enhancer, acrobat pro, pdfsizeopt, multivalent. Each of those tools have a bunch of different settings. With various tricks in the TeX source (image optimization, etc). They investigate various different types of document (image-heavy, text-heavy, etc).

The final recommended workflow for small PDFs is: 1. use pdftex; 2. process with pdf enhancer or acrobat pro if you have them; 3. process with pdfsizeopt (including the optional multivalent step).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.