Optimising your pdf file – latex dvips ps2pdf

For those wanting to distribute latex documents in pdf file format, it is possible to leave all optimisation of the file to the last step.

latex command generates dvi file.

dvips command generates ps file

ps2pdf command generates pdf file.

ps2pdf has a lot of possible options for file optimisation. The option -dPDFSETTINGS=
provides several sets of defaults to generate output similar to the acrobat distiller program in windows and mac (of course in linux you also have flexibility to specify every other option too if you wanted).

For example;

ps2pdf file.ps file.pdf generates big file

ps2pdf -dPDFSETTINGS=/screen file.ps file_screenoptimised.pdf generates small file suitable for reading on computer screen only

ps2pdf -dPDFSETTINGS=/ebook file.ps file_ebookoptimised.pdf generates slightly larger file with higher resolution graphics suitable for ebook readers

It is also possible to do this avoiding generating the ps file

Following linuxaria.com

After install ghostscript on your machine, then using following command;
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

The following options are available for dPDFSETTINGS

-dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook (low quality, 150 dpi images)
-dPDFSETTINGS=/printer (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default (almost identical to /screen)


3 Responses

  1. according to wikibooks it is also possible to use ghostscript to make a compressed pdf http://en.wikibooks.org/wiki/LaTeX/Absolute_Beginners

    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=”Compressed.pdf” “Original.pdf”

  2. Does anyone know if there is command to compress pdf without changing it to ps file first? pdf2pdf command?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: