A PDF merging library built using Rust and Rustler, with precompiled binaries.
- Basically wraps the Merge PDF example from lopdf using Rustler
- Can merge pdfs from binaries or paths
- Uses RustlerPrecompiled so every dev in a project using this library doesn't need Rust installed on their machine.
The package can be installed
by adding merge_pdf to your list of dependencies in mix.exs:
def deps do
[
{:merge_pdf, "~> 0.5.0"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/merge_pdf.
This project uses RustlerPrecompiled to distribute precompiled native binaries. For development, you'll build the Rust NIF from source.
just setupThis cleans any stale artifacts and builds the NIF from source. Run this when:
- You first clone the repo
- You switch branches with native code changes
- You get precompilation-related errors
just build # Rebuild NIF after Rust changes
just test # Run testsAll development commands use MERGE_PDF_BUILD=true internally to force building from source rather than downloading precompiled binaries.
This project builds precompiled binaries for 9 platforms via GitHub Actions. The release process has two phases: before CI (local verification) and after CI (publishing).
- Authenticate with Hex.pm:
mix hex.user auth - Ensure GitHub Actions has write permissions (Settings > Actions > General)
These steps verify everything works before creating a release.
# 1. Bump version in mix.exs and Cargo.toml
just bump-version X.Y.Z
# 2. Verify everything builds and tests pass
# (This does a clean build from source - catches Rust compilation errors)
just verify-local
# 3. Review and commit the version bump
git diff
git add -p
git commit
# 4. Create the git tag
just tag X.Y.Z
# 5. Push to GitHub (triggers CI to build all 9 platform binaries)
just push-releaseAt this point, wait for GitHub Actions to complete. All 9 platform builds must succeed.
Once CI completes successfully, the precompiled binaries are attached to the GitHub release. Now generate checksums and publish.
# 6. Download checksums from the GitHub release
# (This verifies all 9 binaries are downloadable)
just download-checksums
# 7. Inspect the hex package contents
just verify-package
# 8. Publish to hex.pm
just publishDevelopment:
just setup- First-time setup, builds NIF from sourcejust build- Rebuild NIF from sourcejust test- Run tests
Pre-release:
just verify-local- Clean build + tests (run before tagging)just bump-version X.Y.Z- Update version numbers
Release:
just tag X.Y.Z- Create git tagjust push-release- Push to GitHub (triggers CI)just download-checksums- Download checksums after CIjust verify-package- Inspect hex packagejust publish- Publish to hex.pm
Utilities:
just version- Show current versionjust clean- Remove build artifactsjust --list- List all commands