Thanks for your interest in contributing to Folio!
git clone https://github.com/carlos7ags/folio-java.git
cd folio-java
./gradlew buildRequires JDK 22+ (Temurin recommended).
lib/ Main SDK
src/main/java/dev/foliopdf/ Public API (fluent builders)
src/main/java/dev/foliopdf/internal Panama FFI bindings
src/main/resources/natives/ Bundled native libraries (5 platforms)
src/test/java/dev/foliopdf/ JUnit 5 tests
examples/ Runnable examples
The Java SDK wraps the Folio Go engine via Panama FFI (JEP 454). The Go engine is compiled to a C shared library (libfolio.so / .dylib / .dll) and bundled in the JAR. At runtime, NativeLoader extracts the correct binary for the current platform and loads it via System.load().
All native calls go through FolioNative.java which holds 372 MethodHandle downcalls. Public API classes in dev.foliopdf.* provide fluent Java wrappers around these raw bindings.
When the Go engine adds a new C export:
- Add the
MethodHandle+ Java method inFolioNative.javafollowing the existing pattern - Add or update the public API class in
dev.foliopdf/ - Add a test in
lib/src/test/java/dev/foliopdf/ - Run
./gradlew buildto verify
- Follow existing patterns — look at similar classes before writing new code
- Every
if (h == 0)check must includeFolioNative.lastError()in the exception message - Public API methods should be fluent (return
this) where it makes sense - Use
AutoCloseable+HandleReffor any class that owns a native handle - Javadoc on all public classes and methods
./gradlew testTests run with --enable-native-access=ALL-UNNAMED automatically (configured in build.gradle.kts).
Native libraries come from Folio releases:
gh release download vX.Y.Z -R carlos7ags/folio
# Copy each to lib/src/main/resources/natives/{platform}/Folio is licensed under Apache 2.0 and developed independently. Do not reference, port, or adapt code from other PDF libraries. All contributions must be original work.
Run the full build locally:
./gradlew buildThis compiles, runs tests, and generates javadoc. CI will reject failing builds.
- Fork the repository
- Create a feature branch (
git checkout -b feat/my-feature) - Make your changes
- Run
./gradlew build(must pass) - Open a pull request
Open an issue at https://github.com/carlos7ags/folio-java/issues with:
- JDK version (
java -version) - Operating system and architecture
- Minimal reproduction code
- Stack trace (if applicable)
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.