pdf-compressor 0.5.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pdf_compressor-0.5.0.data/scripts/pdf-compressor.exe +0 -0
- pdf_compressor-0.5.0.dist-info/METADATA +89 -0
- pdf_compressor-0.5.0.dist-info/RECORD +6 -0
- pdf_compressor-0.5.0.dist-info/WHEEL +4 -0
- pdf_compressor-0.5.0.dist-info/licenses/license +21 -0
- pdf_compressor-0.5.0.dist-info/sboms/pdf-compressor.cyclonedx.json +4147 -0
|
Binary file
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pdf-compressor
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
License-File: license
|
|
5
|
+
Summary: CLI for batch compressing PDFs with iLovePDF.com
|
|
6
|
+
Keywords: cli,compression,ilovepdf,pdf
|
|
7
|
+
Author: Janosh Riebesell <janosh.riebesell@gmail.com>
|
|
8
|
+
Author-email: Janosh Riebesell <janosh.riebesell@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
11
|
+
Project-URL: Source Code, https://github.com/janosh/pdf-compressor
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="https://raw.githubusercontent.com/janosh/pdf-compressor/840821cea3da4d2a4fa989732ebea071bfe1f988/assets/pdf-compressor.svg" alt="PDF Compressor" height=150>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<h3 align="center">
|
|
18
|
+
|
|
19
|
+
[](https://github.com/janosh/pdf-compressor/actions/workflows/ci.yml)
|
|
20
|
+
[](https://crates.io/crates/pdf-compressor)
|
|
21
|
+
[](https://pypi.org/project/pdf-compressor)
|
|
22
|
+
[](https://pypistats.org/packages/pdf-compressor)
|
|
23
|
+
|
|
24
|
+
</h3>
|
|
25
|
+
|
|
26
|
+
Command line PDF compression powered by the free [iLovePDF API](https://developer.ilovepdf.com).
|
|
27
|
+
|
|
28
|
+
**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.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
A single self-contained binary, installable either way:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install pdf-compressor # prebuilt wheels, no Rust toolchain needed
|
|
36
|
+
cargo install pdf-compressor
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
First, tell `pdf-compressor` your iLovePDF API key (if you haven't yet, get one by signing up at <https://developer.ilovepdf.com/signup>):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pdf-compressor --set-api-key project_public_7c854a9db0...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This saves the key to `~/.config/pdf-compressor/api-key` (`$XDG_CONFIG_HOME` is respected, `%APPDATA%` on Windows). Alternatively, set the `ILOVEPDF_PUBLIC_KEY` environment variable, which takes precedence.
|
|
48
|
+
|
|
49
|
+
Then start compressing!
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
pdf-compressor **/*.pdf # writes foo-compressed.pdf next to each foo.pdf
|
|
53
|
+
pdf-compressor docs/ -o out/ -s "" # all PDFs under docs/ into out/ with original names
|
|
54
|
+
pdf-compressor -i report.pdf # replace original (moved to the system trash)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
All inputs are validated (output paths, stats file type, file existence) before anything is uploaded, so typos don't cost API quota. Uploads stream from disk, up to 4 at a time, with a progress line when run in a terminal.
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
| Flags | Default | Description |
|
|
62
|
+
| -------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `-i/--inplace` | off | Replace originals with compressed PDFs. Originals go to the system trash (macOS Trash, Windows Recycle Bin, freedesktop trash on Linux). Conflicts with `--suffix` and `--outdir`. |
|
|
64
|
+
| `-s/--suffix` | `-compressed` | Appended to compressed file names. May be empty together with `--outdir`. |
|
|
65
|
+
| `-o/--outdir` | next to input | Directory to write compressed PDFs into (created if missing). |
|
|
66
|
+
| `--cl/--compression-level` | `recommended` | One of `low`, `recommended`, `extreme`. `extreme` noticeably degrades embedded bitmap images. |
|
|
67
|
+
| `--min-red/--min-size-reduction` | 10 with `-i`, else 0 | Only keep compressed files that are more than this many percent smaller. |
|
|
68
|
+
| `--password` | | Password for protected PDFs. All inputs share it; PDFs with different passwords must be compressed separately. |
|
|
69
|
+
| `--set-api-key` | | Save the iLovePDF public key. Can't be combined with other flags. |
|
|
70
|
+
| `--report-quota` | | Print the number of remaining files in the current billing cycle. |
|
|
71
|
+
| `--write-stats-path` | | Write per-file original vs compressed sizes and actions taken to a `.csv` file. |
|
|
72
|
+
| `-v/--version` | | Print the version. |
|
|
73
|
+
|
|
74
|
+
Set `ILOVEPDF_API_URL` to point at a different API endpoint (default `https://api.ilovepdf.com`).
|
|
75
|
+
|
|
76
|
+
## Migrating from v0.4 (Python)
|
|
77
|
+
|
|
78
|
+
v0.5 is a Rust rewrite. The CLI keeps its flags with these exceptions:
|
|
79
|
+
|
|
80
|
+
- The Python API (`from pdf_compressor import compress, Compress`) is gone. Call the CLI via `subprocess`.
|
|
81
|
+
- `--verbose`, `--on-no-files` and `--on-bad-files` were removed: finding no PDFs exits 0 silently, passing a non-PDF file is an error, and results always show paths as given.
|
|
82
|
+
- `--set-api-key` writes to the user config dir instead of a `.env` file inside the installed package. Re-run it once after upgrading, or set `ILOVEPDF_PUBLIC_KEY`.
|
|
83
|
+
- `--debug` was removed.
|
|
84
|
+
- `--outdir` now actually places the compressed PDFs there (it previously only changed where the download was staged).
|
|
85
|
+
- `--write-stats-path` writes CSV only (no more JSON/Excel/HTML or pandas dependency), and other extensions are an error instead of silently writing nothing.
|
|
86
|
+
- `.pdfa`/`.pdfx` extensions are no longer picked up; only `.pdf` (any case).
|
|
87
|
+
- Errors exit with code 1 and a one-line message instead of a Python traceback.
|
|
88
|
+
- Local file paths are no longer sent to iLovePDF; uploads are named `0.pdf`, `1.pdf`, ...
|
|
89
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
pdf_compressor-0.5.0.data/scripts/pdf-compressor.exe,sha256=7jfaxEU3ilzikE_jGuDnB0ht1TvD6Wa2ChUZeVhG3xo,2975744
|
|
2
|
+
pdf_compressor-0.5.0.dist-info/METADATA,sha256=h-C3hoIHoqyEHCKJArRhSUgwsK2ISGbsYGOJ_d8wr50,6113
|
|
3
|
+
pdf_compressor-0.5.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
|
|
4
|
+
pdf_compressor-0.5.0.dist-info/licenses/license,sha256=XwJs1lEtrGYxeKuYnuBz8V06Mh2Hx0BKoIKucLew70g,1094
|
|
5
|
+
pdf_compressor-0.5.0.dist-info/sboms/pdf-compressor.cyclonedx.json,sha256=pFxSy_NJWEqIXZUoHlqXRncpCFqxettjFXlukgH2iI8,131069
|
|
6
|
+
pdf_compressor-0.5.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Janosh Riebesell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
The software is provided "as is", without warranty of any kind, express or
|
|
16
|
+
implied, including but not limited to the warranties of merchantability,
|
|
17
|
+
fitness for a particular purpose and noninfringement. In no event shall the
|
|
18
|
+
authors or copyright holders be liable for any claim, damages or other
|
|
19
|
+
liability, whether in an action of contract, tort or otherwise, arising from,
|
|
20
|
+
out of or in connection with the software or the use or other dealings in the
|
|
21
|
+
software.
|