Swan is a lightweight, fast, and dependency-minimal command-line toolkit for PDF manipulation, built entirely in C on top of PDFio.
It provides a set of powerful subcommands to merge, split, reorder, inspect, and generate PDFs — all under a permissive license.
- Merge multiple PDF files into one
- Inspect internal structure, objects, and metadata (
pdf-info) - Reorder or select specific pages
- Split a PDF into multiple smaller PDFs
- Create a PDF from one or more images (
imagetopdf)
$ ./swan
swan — PDF Swiss-Army CLI
Usage:
./swan <command> [options] [args]
Commands:
merge Concatenate multiple PDFs into one
pdf-info Debug-print PDF structure
reorder Reorder pages within a PDF
split Split a PDF into multiple files
imagetopdf Create a PDF from images
Run './swan <command> -h' for command-specific help.- Operating System: Linux (Ubuntu, Debian, Fedora, Arch), or macOS
- Compiler: GCC ≥ 9.0 or Clang ≥ 10.0
- Build System:
makeorcmake - Libraries:
libjpeg(for image input support)zlib(for compression and streams)pdfio(the core PDF I/O library)
- Ubuntu / Debian
sudo apt update
sudo apt install -y build-essential cmake git pkg-config \
libjpeg-dev zlib1g-dev-- Fedora / RHEL
sudo dnf install -y make gcc cmake git \
libjpeg-turbo-devel zlib-devel-- Arch Linux
sudo pacman -S base-devel cmake git libjpeg-turbo zlibSwan depends on PDFio ≥ 1.6.0. If you don’t have it installed system-wide, build it from source - https://github.com/michaelrsweet/pdfio/releases/tag/v1.6.0
To build the source, all you have to do is
make
To verify just run
./swan