Sometimes we need to reduce the size of a PDF file, without altering its content and without having access to the source code.
In order to do that, we can use gs this way:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
-dPDFSETTINGS=/screen option is used to specify that we want the PDF optimized to be displayed on a screen, reducing its size while loosing images quality.
We can specify /ebook instead of /screen to have a slightly better image quality, but still reducing file size.