How to compress a PDF in Linux.
Learn how to reduce the file size of PDFs on your Linux device using the command line and online resources.
Multi-page PDFs can quickly become too big to email or upload. Luckily, there are a few ways you can compress files to make it easier to handle larger PDFs. Here are the best ways to compress a PDF with Linux.
PDF compress in Linux with command line utilities.
If you run Debian or Ubuntu, you can compress PDFs with the Ghostscript command line tool. Ghostscript is software that interprets certain file types, so your Linux device can read and edit PDFs.
To begin, install Ghostscript with the command “sudo apt install ghostscript.” Once installed, you can use this command to compress PDF file sizes:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -
dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -
In the command, replace output.pdf and input.pdf with your chosen filenames. The “dPDFSETTINGS” is where you’ll choose the file size. Change the suffix “=/screen” to suit your need:
- -dPDFSETTINGS=/screen — Low quality and small size at 72dpi.
- -dPDFSETTINGS=/ebook — Slightly better quality but also a larger file size at 150dpi.
- -dPDFSETTINGS=/prepress — High quality and large size at 300 dpi.
- -dPDFSETTINGS=/default — System chooses the best output, which can create larger PDF files.
Once you input your preferences, simply run the command. Your new compressed PDF will be saved in the same folder as the original.
Use an online PDF editor.
If you’re not comfortable with commands, the easiest way to compress a PDF is with an online PDF editor like Adobe Acrobat online services. Simply visit the Acrobat online services website from any web browser and follow three simple steps:
- Upload your file.
- Select the PDF to compress.
- Download the compressed file to your device.
The online PDF editor will compress the file without losing quality, and you won’t need to download software or enter commands.