A PDF file comes out of large size when it contains many images. The traditional way to reduce the size is to compress the images via official tools like Adobe Acrobat. However, it is not free and not open source.
ps2pdf is a free and open-source command-line tool that is part of the Ghostscript suite. It is used to convert PostScript files to PDF format, and it can also be used to optimize existing PDF files by reducing their size.
A practical guidance to optimize PDF files is to use ps2pdf as follows:
$ ps2pdf [options] input.ps output.pdf
preset PDFSETTINGS options are:
/screen low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting
/ebook medium-resolution output similar to the Acrobat Distiller "eBook" setting
/default output similar to the Acrobat Distiller "Default Settings" setting
/printer output similar to the Acrobat Distiller "Print Optimized" setting
/maximum output similar to the Acrobat Distiller "Maximum Quality" setting
so the command to optimize a PDF file is like this:
$ ps2pdf -dPDFSETTINGS=/screen input.pdf output.pdf