Erwin Müller Blog

Compress Pdf files for email

From Latex generated Pdf files that contain pictures are usually very large, for example, my résumé that contains my profile picture and pictures of my certificates is about 4.0 MByes big. That size is usually too large to send per email for an online job application. The solution is obviously to compress the Pdf to an acceptable size. But it is considered bad practice if we use Zip or Tar.gz archives, because then the receiver is expected to decompress my application first. Not everyone is fluent in computer and it’s also just an extra step for the application receiver. Office applications like LibreOffice, OpenOffice, Microsoft Office, etc. can usually compress the pictures before creating the Pdf. So, how can we do the same with Latex.

We can use the gs Ghostscript command, that is available on Linux, to compress a Pdf file for different image qualities and DPI. Those below are the available quality settings.

We can wrap that in a nice Bash script and also in a make file script so we can easily compress the generated résumé files to acceptable sizes. Furthermore, we can use the pdftk command to keep the Pdf meta data, like title, author, etc. because plain gs will generate a new Pdf file with new meta data.

With and makefile in the same directory as the Pdf files we have now two commands available.

  • make compress will compress all of the résumé files. The compressed files will have the _print postfix attached;
  • make bewerbung will compress all only the application letter. The compressed file will have the _print postfix attached.


  • pdfsizeopt is a project on Github that compresses Pdf files.




Leave a Reply