A Rust desktop app for cropping PDFs on macOS, Windows, and Linux. It uses GPUI Kit for the interface and PDFium for PDF rendering and saving.
Open a PDF, review the suggested crop on every page, drag a crop edge or corner to adjust an individual page, then choose Save cropped PDF. Detection finds non-white content and adds a fixed 5 mm margin. The saved PDF uses page CropBoxes, so text and vector graphics remain selectable and content outside the crop remains embedded.
Install Rust and the GPUI Kit platform prerequisites. From this directory:
bash scripts/run.shThe script downloads the PDFium 7881 library matching the pinned pdfium-render bindings and places it next to the executable. It supports macOS arm64/x64, Linux arm64/x64, and Windows x64 from Git Bash.
To run the PDF round-trip tests, put the library next to the test process or set PDFIUM_LIBRARY_PATH to its full path:
PDFIUM_LIBRARY_PATH=/path/to/libpdfium.dylib cargo testbash scripts/package.shThe package is written under dist/. It includes the executable, matching PDFium library, and PDFium-LICENSE. The macOS output is an unsigned .app bundle; sign and notarize it before public distribution.
GitHub Actions runs only when a release tag is pushed. Before tagging a release, check formatting, run the PDF tests with the PDFium library for your local architecture, and package the app:
cargo fmt -- --check
bash scripts/fetch-pdfium.sh target/pdfium
PDFIUM_LIBRARY_PATH="$PWD/target/pdfium/libpdfium.dylib" cargo test --locked # macOS
bash scripts/package.shOn Linux, use libpdfium.so for PDFIUM_LIBRARY_PATH; on Windows, use pdfium.dll. Update the version in Cargo.toml, commit the tested changes with git commit -s, then push a matching version tag. The release workflow checks the tag, tests and packages macOS, Windows, and Linux, then attaches their archives to one GitHub Release. The macOS archive is unsigned.
The PDF in examples/ is a local example and is excluded from Git. Automated tests use the synthetic PDF in tests/fixtures/.
The app icon is drawn in assets/app-icon.svg. To regenerate the PNG, ICO, and ICNS files after editing it, run cargo run --example render_icon. The macOS bundle uses the ICNS file, the Windows executable embeds the ICO file, and the Linux package includes the PNG file.
The native save dialog suggests <source>-cropped.pdf. The app refuses to save over the source PDF.