Skip to main content

CLI + Python API for batch compressing PDFs with iLovePDF.com

Project description

PDF Compressor

Tests pre-commit.ci status PyPI Requires Python 3.8+ PyPI Downloads

The code in ilovepdf.py was inspired by Andrea Bruschi's pylovepdf.

Command line PDF compression powered by the free iLovePDF API.

Installation

pip install pdf-compressor

Usage

Tell pdf-compressor your iLovePDF API key (if you haven't yet, get one by signing up at https://developer.ilovepdf.com/signup):

pdf-compressor --set-api-key project_public_7c854a9db0...

Then start compressing!

pdf-compressor **/*.pdf

Options

pdf-compressor has the following flags:

  • -i/--inplace (optional, default: False): Whether to compress PDFs in place.
  • -s/--suffix (optional, default: '-compressed'): String to append to the filename of compressed PDFs. Mutually exclusive with --inplace.
  • --cl/--compression-level (optional, default: 'recommended'): How hard to squeeze the file size. 'extreme' noticeably degrades quality of embedded bitmap images.
  • --set-api-key (optional): Set the public key needed to authenticate with the iLovePDF API. You only need to do this once to start using.
  • --report-quota (optional): Report the number of remaining file operations in the current billing cycle for the stored iLovePDF public API key.
  • --debug (optional, default: False): When true, iLovePDF won't process the request but only reports the parameters that would have been sent to the server.
  • -v/--version (optional): Get your version number of pdf-compressor.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf-compressor-0.1.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

pdf_compressor-0.1.3-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pdf-compressor-0.1.3.tar.gz.

File metadata

  • Download URL: pdf-compressor-0.1.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for pdf-compressor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 15a0cb8477138d936fe3dc68dbed2e15d2716e5597c992a00b8702afed914c9e
MD5 f79087a742c4e0e1bfe12ae34140adc8
BLAKE2b-256 793723d0ca72cf1303398bfb999b2e7ff35f21e34c937f346ecb6a6b391ad19f

See more details on using hashes here.

File details

Details for the file pdf_compressor-0.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: pdf_compressor-0.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for pdf_compressor-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f7d729ff56db08bff21bb84d13736a6170eabde233688b0c29655a6e74bf8a8f
MD5 844d0b788fb12c23ecb85bfbb3bfae16
BLAKE2b-256 315224b150a3cdfa8562c5c73c4013e263cc9e2964ee742991ff2b751573f97e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page