{"id":16510767,"url":"https://github.com/janosh/pdf-compressor","last_synced_at":"2025-04-09T12:04:07.342Z","repository":{"id":41932345,"uuid":"376834832","full_name":"janosh/pdf-compressor","owner":"janosh","description":"CLI + Python API for batch compressing PDFs","archived":false,"fork":false,"pushed_at":"2025-03-25T14:21:03.000Z","size":139,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T06:51:34.613Z","etag":null,"topics":["cli","compression","ilovepdf-api","pdf"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pdf-compressor","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janosh.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-14T13:35:10.000Z","updated_at":"2025-03-25T14:20:50.000Z","dependencies_parsed_at":"2024-07-18T23:36:27.473Z","dependency_job_id":"85e25266-4075-4059-a6f7-8661e4510b06","html_url":"https://github.com/janosh/pdf-compressor","commit_stats":{"total_commits":71,"total_committers":3,"mean_commits":"23.666666666666668","dds":0.09859154929577463,"last_synced_commit":"a7b7556555205568106d140254b8db3ad0554938"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janosh%2Fpdf-compressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janosh%2Fpdf-compressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janosh%2Fpdf-compressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janosh%2Fpdf-compressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janosh","download_url":"https://codeload.github.com/janosh/pdf-compressor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036064,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","compression","ilovepdf-api","pdf"],"created_at":"2024-10-11T15:57:06.907Z","updated_at":"2025-04-09T12:04:07.322Z","avatar_url":"https://github.com/janosh.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/janosh/pdf-compressor/main/assets/pdf-compressor.svg\" alt=\"PDF Compressor\" height=150\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n\n[![Tests](https://github.com/janosh/pdf-compressor/workflows/Tests/badge.svg)](https://github.com/janosh/pdf-compressor/actions)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/janosh/pdf-compressor/main.svg)](https://results.pre-commit.ci/latest/github/janosh/pdf-compressor/main)\n[![PyPI](https://img.shields.io/pypi/v/pdf-compressor?logo=pypi\u0026logoColor=white)](https://pypi.org/project/pdf-compressor)\n[![Requires Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg?logo=python\u0026logoColor=white)](https://python.org/downloads)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/pdf-compressor?logo=icloud\u0026logoColor=white)](https://pypistats.org/packages/pdf-compressor)\n\n\u003c/h3\u003e\n\nCommand line PDF compression powered by the free [iLovePDF API](https://developer.ilovepdf.com).\n\n**Why?** iLovePDF delivers the best PDF compression I've seen but their web UI doesn't support automation and can be cumbersome when dealing with many files.\n\n## Installation\n\n```sh\npip install pdf-compressor\n```\n\n## Usage\n\nFirst, tell `pdf-compressor` your iLovePDF API key (if you haven't yet, get one by signing up at \u003chttps://developer.ilovepdf.com/signup\u003e):\n\n```sh\npdf-compressor --set-api-key project_public_7c854a9db0...\n```\n\nThen start compressing!\n\n```sh\npdf-compressor **/*.pdf\n```\n\n## Options\n\n| Flags                      | Default         | Description                                                                                                                                                                                                                 |\n| -------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `-i/--inplace`             | `False`         | Whether to compress PDFs in place.                                                                                                                                                                                          |\n| `-s/--suffix`              | `'-compressed'` | String to append to the filename of compressed PDFs. Mutually exclusive with `--inplace`.                                                                                                                                   |\n| `--cl/--compression-level` | `'recommended'` | How hard to squeeze the file size. One of `'low'`, `'recommended'`, `'extreme'`. `'extreme'` noticeably degrades quality of embedded bitmap images.                                                                         |\n| `--set-api-key`            |                 | Set the public key needed to authenticate with the iLovePDF API. You only need to do this once to start using.                                                                                                              |\n| `--report-quota`           |                 | Report the number of remaining file operations in the current billing cycle for the stored iLovePDF API key.                                                                                                                |\n| `--debug`                  | `False`         | When true, iLovePDF won't process the request but only reports the parameters that would have been sent to the server.                                                                                                      |\n| `--verbose`                | `False`         | When true, progress will be reported while tasks are running.                                                                                                                                                               |\n| `-v/--version`             |                 | Get the version number of `pdf-compressor`.                                                                                                                                                                                 |\n| `--on-no-files`            | `'ignore'`      | What to do when no input PDFs received. One of `'ignore'` or `'error'`, former exits 0, latter raises `ValueError`. Can be useful when using `pdf-compressor` in shell scripts.                                             |\n| `--on-bad-files`           | `'error'`       | How to behave when receiving input files that don't appear to be PDFs. One of `'error'`, `'warn'`, `'ignore'`. Error type will be `ValueError`. Code used to check if something is PDF: `filepath.lower().endswith(\".pdf\")` |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanosh%2Fpdf-compressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanosh%2Fpdf-compressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanosh%2Fpdf-compressor/lists"}