pdfx is a fast, privacy-friendly command-line tool for working with PDFs, images, and documents entirely on your machine.
No uploads.
No tracking.
No shady websites.
Just one binary and predictable commands.
Every time you fill a form or submit documents, you end up needing to:
- merge PDFs
- delete or reorder pages
- compress files under size limits
- convert images or documents to PDF
The usual solution?
Uploading sensitive documents (IDs, contracts, resumes) to random websites.
pdfx exists to fix this.
pdfx is a local alternative to tools like SmallPDF / iLovePDF —
but transparent, scriptable, and privacy-first.
- 🔐 Local-first — all processing happens on your machine
- 🚫 No cloud, no telemetry, no tracking
- ⚡ Fast & scriptable — designed for CLI workflows
- 📦 Single Go binary — easy to distribute
- 🧩 Explicit dependencies — no hidden magic
- Merge multiple PDFs
- Delete pages (true delete, inclusive ranges)
- Split PDFs into pages
- Extract selected pages
- Compress PDFs (3 quality levels)
- Convert images → PDF
- Compress images (good / better / best)
- Convert image formats (jpg ↔ png)
.docx,.pptx,.xlsx→ PDF (LibreOffice).txt,.md,.html→ PDF (Pandoc)
- Built-in
doctorcommand to verify dependencies
First install the external dependency for sanity check use pdfx doctor then install the binary.
Linux
sudo apt install ghostscript pandoc libreofficeMacOS
brew install ghostscript pandoc
brew install --cask libreofficeDownload the latest release from GitHub Releases and place it in your PATH.
chmod +x pdfx
mv pdfx /usr/local/bin/git clone https://github.com/yourusername/pdfx
cd pdfx
go buildpdfx merge a.pdf b.pdf c.pdf -o merged.pdfpdfx delete report.pdf --pages 1,3-5,n -o cleaned.pdfDeletes page 1, pages 3-5, and the last page (
n).
pdfx split report.pdf --pages 1-3Creates:
report_page_1.pdf,report_page_2.pdf,report_page_3.pdf
pdfx compress large.pdf --level best -o small.pdfCompression levels:
good— High quality, moderate compressionbetter— Balanced (default)best— Smallest file size
pdfx img2pdf *.jpg -o images.pdfSupported formats: .jpg, .jpeg, .png, .webp, .bmp, .tif, .tiff
pdfx convert resume.docx -o resume.pdf
pdfx convert notes.md -o notes.pdfpdfx img-compress photo.jpg --level best -o photo_small.jpgpdfx img-convert image.webp -o image.pngUsed by delete, split, and extract commands:
| Syntax | Meaning |
|---|---|
1 |
Page 1 |
3-5 |
Pages 3, 4, 5 (inclusive) |
n |
Last page |
2-n |
Page 2 through last page |
1,3-5,n |
Multiple ranges |
⚠️ Note:1-n(delete all pages) is not allowed in thedeletecommand.
pdfx doctorVerifies that external tools are installed and available in your PATH.
pdfx merge <pdf1> <pdf2> [pdf3 ...] -o <output.pdf>Flags:
-o,--output— Output PDF file (default:merged.pdf)
pdfx delete <input.pdf> --pages <ranges> -o <output.pdf>Flags:
--pages— Pages to delete (required)-o,--output— Output PDF
Examples:
pdfx delete file.pdf --pages 3 -o out.pdf
pdfx delete file.pdf --pages 1,4-6,n -o cleaned.pdfpdfx split <input.pdf> --pages <ranges>Extracts selected pages into individual PDF files.
Example:
pdfx split report.pdf --pages 1-3pdfx extract <input.pdf> --pages <ranges> -o <output.pdf>Example:
pdfx extract report.pdf --pages 2,4-6 -o excerpt.pdfpdfx img2pdf <image1> <image2> [...] -o <output.pdf>Examples:
pdfx img2pdf a.jpg b.png -o images.pdf
pdfx img2pdf *.jpg -o album.pdfpdfx compress <input.pdf> --level <good|better|best> -o <output.pdf>Flags:
--level— Compression level (default:better)-o,--output— Output PDF (default:compressed.pdf)
pdfx convert <input.file> -o <output.pdf>Supported formats:
- Text:
.txt,.md,.html(via Pandoc) - Office:
.docx,.pptx,.xlsx,.odt(via LibreOffice)
pdfx img-compress <image> --level <good|better|best> -o <output>Supported formats:
- Input:
.jpg,.jpeg,.png,.webp - Output:
.jpg,.png
pdfx img-convert <image> -o <output>Supported output: .jpg, .png
Every command has built-in help:
pdfx --help
pdfx delete --help
pdfx compress --help- ✅ No internet access
- ✅ No uploads
- ✅ No data collection
- ✅ No telemetry
- ✅ No background services
You own your data. Always.
- Page reordering
- Batch operations
- Config file support
- Homebrew / Scoop packages
- Windows-friendly installers
MIT License — use it, fork it, improve it.
This project was built to be useful first, clever second.
If it saved you time or protected your privacy —
⭐ star the repo, or better, tell someone about it.
Happy hacking 🚀