sudo apt update
sudo apt install ghostscript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
input.pdf: Replace with your original file name.output.pdf: The name of the new compressed file.
/screen setting makes the text look too blurry, try /ebook (150 dpi), which balances good quality with a smaller file size:gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
-dPDFSETTINGS=/screen: 72 dpi, lowest quality, smallest size (best for >2MB requirement).-dPDFSETTINGS=/ebook: 150 dpi, medium quality, better for reading.-dPDFSETTINGS=/printer: 300 dpi, high quality, likely to keep the file over 2MB.