
Also, stay tuned to learn about an alternative compressor software that makes compressing PDFs easy and without any problems. Let's get started.
How to Use Ghostscript to Compress PDF
Ghostscript is a free, powerful, and open-source interpreter, primarily for PostScript and PDF files. It is widely used for viewing, converting, and compressing PDFs. It delivers excellent compression rates and performance and can compress a PDF 50% or more without the commercial best PDF compressors. You can use the Ghostscript command line to compress PDFs on Windows, Mac, or Linux computers. While you can compress a PDF with Ghostscript, it also supports high customization using command-line options. However, its steep learning curve can be tough to use for beginners and newbies.
#1. Ghostscript to reduce PDF size on Windows:
Step 1: Open Ghostscript's official site or use this link directly to proceed: www.ghostscript.com/download/gsdnld.html. Download and run the Windows installer. Follow the on-screen instructions and add Ghostscript to your system PATH.
Step 2: Press the Win + R keys and type CMD. Then, hit Enter to launch the Command Prompt.
Step 3: Run the following command:
gswin64c -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output.pdf" "input.pdf"
Note: For 32-bit systems, replace 'gswin64c' with 'gswin32c.'
Also, replace "input.pdf" with your original PDF file and "output.pdf" with the name of your compressed PDF file
Step 4: Select a compression level and adjust the "-dPDFSETTINGS" value to change the quality to compress the PDF with Ghostscript.
For e.g.:
- To view on screens only, choose /screen for low quality and the smallest file size
- To view ebooks, select /ebook for medium quality and a smaller file size
- For office printing, opt for /printer for high quality and a bigger file size
- For professional prints, choose /prepress to get very high quality and the largest file size
Step 5: Find your compressed file (output.pdf) in the same directory unless you have specified a specific path.
#2. Ghostscript PDF Compression on Mac:
Step 1: Press the Command + Space keys and type "Terminal" to open it. Alternatively, you can directly press the F4 key on your keyboard.
Install Homebrew (if not already installed) using the command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, in Terminal, type 'brew install Ghostscript' to install Ghostscript. Wait for the process to complete.
Alternatively, download the Mac version from Ghostscript's official site. Ensure that you install the '.pkg' file.
Step 2: Run the Ghostscript compression command:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dDetectDuplicateImages=true -dColorImageResolution=150 -dGrayImageResolution=150 -dMonoImageResolution=300 -sOutputFile="compressed.pdf" "original.pdf"
Note: Replace "original.pdf" with your original PDF file's name, and "compressed.pdf" will be the name of your new compressed PDF file
Step 3: Check the compressed file size: ls -lh compressed.pdf
Select a compression level and adjust the "-dPDFSETTINGS" value to change the quality.
Step 4: Find your compressed PDF file in the same directory unless you have specified a specific path. Open it with Preview or a qualified PDF reader.
As you know, various Ghostscript PDF compression options are available; you may want to select the one with the highest quality. However, remember that the more compressed your file is, the lower its quality will be.
How to Use Python Ghostscript to Compress PDF
You can use a Python Script to hyper compress a PDF using Ghostscript. Use different quality settings to accommodate various file size requirements. While it is a fully automated compression method that can be integrated into larger Python workflows to work across different platforms, it can be complex to use unless you are an advanced user.
Here are the detailed steps for using the Python Ghostscript Compress PDF command line.
Step 1: First, install Ghostscript from the official site on your Windows, Mac, or Linux computers.
Step 2: Implement Python using the following command:
Compress PDF with Ghostscript Alternative
Ghostscript is a powerful tool that can highly compress PDF files (from 50% to 70%). However, its command-line interface and steep learning curve can be challenging for everyday users. For new users and novices seeking a more intuitive and user-friendly alternative, SwifDoo PDF is better than Ghostscript to reduce PDF file size. Here's how its file compression features make it easy for every user to stay productive.
- Compress PDF, Word, Excel, PPT, images, and more formats
- Provides batch compression to save time and energy
- Three selectable compression levels: Low, Medium, and High
- Customizable image resolution and quality
- Lossless compression for high-quality output
Glance at how to compress a PDF with the Ghostscript compression tool alternative, SwifDoo PDF, in a few clicks.
Step 1: Download and open the SwifDoo PDF on your device. Thereafter, locate and click "Compress PDF" on the main interface.
Step 2: Hit the "Add Files" tab to select and import the PDF you wish to compress.
Step 3: Adjust the compression level. You can also click 'Custom' to adjust the resolution and reduce the file size without compromising image quality. Then, click Start to compress your PDF file.
Besides lossless compression, SwifDoo PDF offers additional features such as editing, annotating, creating, converting, merging, splitting, signing, and password-protecting PDFs. It is an all-around solution for all your PDF management tasks and queries.
How Does Ghostscript Compare to Other PDF Compression Tools?
Ghostscript's powerful, scriptable capabilities make it stand out among other PDF compression tools for tech-savvy users. However, SwifDoo PDF's modern interface, ease of use, and real-time adjustments significantly outperform Ghostscript in numerous ways. SwifDoo PDF emerges as the most practical option for everyday PDF tasks.
Look at this comparison table of Ghostscript or its alternative software to compress PDF documents to see how they differ on common grounds.
Key Factors and Highlights |
Ghostscript |
SwifDoo PDF |
Operating System
|
Cross-platform support, including Windows PC, macOS, Linux, and many Unix-like systems |
Available on Windows PC, macOS, iOS, and Android platforms |
PDF Features |
Offers advanced features like imposition, overprint simulation, color management, and basic manipulation (merge, split, optimize) |
Manages all PDF-related tasks: view, edit, annotate, sign, merge/split, convert, compress PDFs, encryption, fill forms, etc. Compress images, PDFs, Word, Excel, etc. |
Customizable Compression Options |
Offers granular control over compression settings via command-line options, allowing users to adjust image resolution, downsampling, and color settings |
Provides an intuitive interface for compressing PDFs, with adjustable compression levels (low, medium, and high) to balance file size and quality |
Batch Processing |
Yes, through command-line scripting |
Yes, for conversion, compression, and merging files |
Ease of Use |
Difficult; steeper learning curve, requires familiarity with scripting and command-line operations. |
Very easy. User-friendly graphical interface designed for ease of use, catering to both beginners and professionals |
Final Words
You might run into storage issues when your PDF files take up a lot of space on your server. Thankfully, Ghostscript is a free and open-source software suite that helps you compress PDF files by up to 70% without losing the document's visual clarity. Here, we have discussed comprehensive compression solutions for different platforms. Depending on your technical knowledge and skill levels, you can opt for the discussed compression method: reduce the PDF size with Ghostscript. Or, download the SwifDoo PDF today for seamless PDF management.