Skip to content

Use this script to resize very large PDFs into smaller ones without obvious degradation in quality.

License

Notifications You must be signed in to change notification settings

DanAbara/shrinkpdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

shrinkpdf

Inspired by this gist.

Use this script to resize/reduce/shrink large pdfs. Feel free to share.

Installation

Requires:

Mac OS & Linux

  • On Mac, install ghostscript using: brew install ghostscript. On Linux, use sudo apt install ghostscript (tested on Ubuntu 18.04)
  • Clone this repo or download shrink.py to your PC.
  • Run sudo chmod +x shrink.py from terminal to make the file executable.
  • Test install. Run ./shrink.py -h to view help.

Windows

Usage

$ ./shrink.py [-h] [-i IN_FILE] [-v VERBOSE] [-q QUALITY]

optional arguments:
-h, --help            show this help message and exit
-i, --in_file         Path to input PDF file. Eg. input.pdf
-q, --quality         Compression quality: screen, ebook, printer, prepress, default. 
-v, --verbose         Output updates while program is running, default True.

The compression level goes from screen as the strongest yielding smaller output files, to default as the weakest yielding higher output files.

Example

$ ./shrink.py -i test.pdf
File checks done...
Shrinking file test.pdf...
Compression quality: default...
Done. PDF reduced by 38.18%, Output size: 7.01 MB.
Resized file written to: /home/daniel/Documents/shrinkpdf/test_resized.pdf.

On Windows, use:

> python shrink.py -i test.pdf

About

Use this script to resize very large PDFs into smaller ones without obvious degradation in quality.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages