# RustyPDF (rustypdf)
CLI tool to compress and merge PDF files using a Rust backend exposed to Python via PyO3/maturin.
## Features
- `compress`: Reduce embedded image dimensions (PNG) with a scale factor (1-10). Placeholder JPEG handling.
- `merge`: Concatenate multiple PDFs preserving page order.
## Installation (local build)
```bash
pip install maturin
maturin develop # or: maturin build --release && pip install target/wheels/rustypdf-*.whl
```
## CLI Usage
```bash
rustypdf --help
rustypdf compress --input input.pdf --output out.pdf --scale 7
rustypdf merge --inputs a.pdf b.pdf c.pdf --output merged.pdf
```
Scale meaning: 1 = minimal compression, 10 = maximum (down to ~25% linear dimension for PNG images). JPEG currently left unchanged (placeholder logic).
## Python API
```python
from rustypdf import compress_pdf, merge_pdfs
merge_pdfs(["a.pdf", "b.pdf"], "merged.pdf")
compress_pdf("in.pdf", "out.pdf", 5)
```
## Notes / Limitations
- Compression is basic and may not always reduce file size, especially for PDFs with already-compressed JPEGs or complex content.
- `rustypdf compress` will automatically detect Ghostscript and, if missing, will best-effort install it using the platform package manager:
- Linux: apt/dnf/yum/zypper/pacman (requires appropriate privileges)
- macOS: Homebrew (`brew`) or MacPorts (`port`)
- Windows: winget/chocolatey/scoop
If installation fails or permissions are insufficient, the command falls back to Rust-only compression and prints a note.
- Not all PDFs may be supported; complex structures or encrypted PDFs are out of scope for this minimal example.
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "rustypdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pdf, compression, merge, cli, rust, pyo3, rustypdf",
"author": "Shyam Sundar <rampallishyam2@gmail.com>",
"author_email": "Shyam Sundar <rampallishyam2@gmail.com>",
"download_url": null,
"platform": null,
"description": "# RustyPDF (rustypdf)\nCLI tool to compress and merge PDF files using a Rust backend exposed to Python via PyO3/maturin.\n\n## Features\n- `compress`: Reduce embedded image dimensions (PNG) with a scale factor (1-10). Placeholder JPEG handling.\n- `merge`: Concatenate multiple PDFs preserving page order.\n\n## Installation (local build)\n```bash\npip install maturin\nmaturin develop # or: maturin build --release && pip install target/wheels/rustypdf-*.whl\n```\n\n## CLI Usage\n```bash\nrustypdf --help\n\nrustypdf compress --input input.pdf --output out.pdf --scale 7\n\nrustypdf merge --inputs a.pdf b.pdf c.pdf --output merged.pdf\n```\n\nScale meaning: 1 = minimal compression, 10 = maximum (down to ~25% linear dimension for PNG images). JPEG currently left unchanged (placeholder logic).\n\n## Python API\n```python\nfrom rustypdf import compress_pdf, merge_pdfs\nmerge_pdfs([\"a.pdf\", \"b.pdf\"], \"merged.pdf\")\ncompress_pdf(\"in.pdf\", \"out.pdf\", 5)\n```\n\n\n## Notes / Limitations\n- Compression is basic and may not always reduce file size, especially for PDFs with already-compressed JPEGs or complex content.\n- `rustypdf compress` will automatically detect Ghostscript and, if missing, will best-effort install it using the platform package manager:\n\t- Linux: apt/dnf/yum/zypper/pacman (requires appropriate privileges)\n\t- macOS: Homebrew (`brew`) or MacPorts (`port`)\n\t- Windows: winget/chocolatey/scoop\n\tIf installation fails or permissions are insufficient, the command falls back to Rust-only compression and prints a note.\n- Not all PDFs may be supported; complex structures or encrypted PDFs are out of scope for this minimal example.\n\n## License\nMIT\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI tool to compress and merge PDFs (Rust backend via PyO3)",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://example.com",
"Repository": "https://example.com/repo"
},
"split_keywords": [
"pdf",
" compression",
" merge",
" cli",
" rust",
" pyo3",
" rustypdf"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3a5353f87261ca16438369f8778300ff12c1b9ea6d9f4ebc6a182ef03c94e16f",
"md5": "49d1ecdbfdbf9a995fd19f6394a830b3",
"sha256": "f397bf0fcbcd6d6d95cb071ece878d3a007946d0617ac752f87523fd13ba9d0a"
},
"downloads": -1,
"filename": "rustypdf-0.1.1-cp312-cp312-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "49d1ecdbfdbf9a995fd19f6394a830b3",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 606052,
"upload_time": "2025-09-12T08:08:19",
"upload_time_iso_8601": "2025-09-12T08:08:19.671583Z",
"url": "https://files.pythonhosted.org/packages/3a/53/53f87261ca16438369f8778300ff12c1b9ea6d9f4ebc6a182ef03c94e16f/rustypdf-0.1.1-cp312-cp312-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4c7f829d896f43a50cf3f7fae44e053d5bd2071ae862ee5fd4cb6f8ac04c43ee",
"md5": "830b8065be07f38127b2cc0b40a441a6",
"sha256": "7455b2dc00885b8b3bffc4902d81b7faa8800d44e5c547456257ad45c671d68e"
},
"downloads": -1,
"filename": "rustypdf-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "830b8065be07f38127b2cc0b40a441a6",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 808438,
"upload_time": "2025-09-12T08:08:21",
"upload_time_iso_8601": "2025-09-12T08:08:21.159922Z",
"url": "https://files.pythonhosted.org/packages/4c/7f/829d896f43a50cf3f7fae44e053d5bd2071ae862ee5fd4cb6f8ac04c43ee/rustypdf-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "02585a901785cca534bad5077eb6769f926ab0d5b76dfb14c8231a0c9129c2f0",
"md5": "833d7ff508360261b1bb9390f5a89ff6",
"sha256": "f07f487f1962f226d1ccede51781b4e90a2fa3929af58f9329d414b89c04d89c"
},
"downloads": -1,
"filename": "rustypdf-0.1.1-cp312-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "833d7ff508360261b1bb9390f5a89ff6",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 585281,
"upload_time": "2025-09-12T08:08:22",
"upload_time_iso_8601": "2025-09-12T08:08:22.489095Z",
"url": "https://files.pythonhosted.org/packages/02/58/5a901785cca534bad5077eb6769f926ab0d5b76dfb14c8231a0c9129c2f0/rustypdf-0.1.1-cp312-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-12 08:08:19",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "rustypdf"
}