Thanks for your interest in improving compose-pdf! This document explains how to contribute and, just as importantly, the invariants that keep the library correct. Please read the Code of Conduct first.
- Open an issue first for anything non-trivial (a bug report or a feature proposal) so the direction can be agreed before you spend time on a PR.
- Fork the repository and create a topic branch (
feature/…orfix/…). - Make your change with tests, then open a pull request against
main. - CI must be green and a maintainer (code owner) must approve before a PR can be merged. Direct
pushes to
mainare not accepted from contributors.
compose-pdf's whole reason to exist is producing identical output on every platform with selectable vector text. A change that weakens any of these will be rejected:
- Integer-only layout. All layout, shaping and measurement math must stay integer (font units / PDF points). No floating point in the layout/serialization hot path — floats are not bit-identical across JVM and Kotlin/Native and would break cross-platform identity.
- Pure shared engine. Everything in
commonMainmust compile as common metadata (./gradlew :composepdf:compileCommonMainKotlinMetadata). Do not calljava.*or any platform-specific API fromcommonMain. - The cross-platform golden must pass.
GoldenLayoutTestasserts exact glyph origins and runs on JVM and natively on iOS. If you intentionally change layout, regenerate the golden, explain why in the PR, and make sure it still passes on every platform. - No real-world data. Tests, samples, comments and docs use invented English dummy data only
(e.g.
ACME Inc.). No real companies, people, or third-party product names.
./gradlew :composepdf:jvmTest # identity + feature gates + golden
./gradlew :composepdf:compileCommonMainKotlinMetadata # shared-code purity
./gradlew :composepdf:compileAndroidMain # Android target
./gradlew :composepdf:iosSimulatorArm64Test # golden on iOS (requires macOS)
Requires JDK 17+ (CI uses 21). On Windows the Apple targets can't be built locally — rely on CI for the iOS job.
- Kotlin official code style; match the surrounding code's naming, structure and comment density.
- Keep public API small and documented with KDoc.
- Use Conventional Commits for commit and PR titles
(
feat:,fix:,docs:,chore:,ci:,refactor:,test:).
By contributing you agree that your contributions are licensed under the project's Apache-2.0 License.