Skip to content

About

Kotlin Multiplatform + pure-Rust document engine SDK (PDF, Word, ODT, RTF, Markdown, HTML)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

doc-engine-sdk

Standalone Kotlin Multiplatform + pure-Rust document engine SDK (com.anto426:doc-engine-sdk) built by extracting the headless parsing, layout, and rendering crates from the open-source Storytold Craft suite (pdfcraft + wordcraft, dual-licensed MIT OR Apache-2.0).

Supported Formats

Feature Flag Formats Engine
pdf (default) .pdf (including password-protected, links, outline/TOC, text layer) pdfcraft-render, pdfcraft-cos, pdfcraft-fonts, pdfcraft-geom
word (default) .docx, .doc, .odt, .fodt, .rtf, .md, .html, .mht, .tex, .txt wordcraft-docx, wordcraft-docbin, wordcraft-formats, wordcraft-layout, wordcraft-pdf
grid (planned) .xlsx, .xls, .ods, .csv gridcraft
deck (planned) .pptx, .odp deckcraft

Capabilities

  • Pure-Rust rendering: RGBA8 page & tile rendering via hayro + vello_cpu (zero Android PdfRenderer / WebView dependency for documents).
  • Native Reading Themes: ReadingTheme.ORIGINAL, ReadingTheme.DARK, ReadingTheme.HIGH_CONTRAST_DARK, ReadingTheme.SEPIA — remaps text and vector line art directly at render time while preserving photos and images.
  • Full-Text Search & Extraction: Page text extraction and case-insensitive / whole-word search with view-space highlight rectangles.
  • Document Inspection: Page dimensions/rotations, document outline (TOC), and clickable URI / internal page links.
  • Unified PDF Export: Export any opened Word / ODT / RTF / Markdown / Text document directly to PDF bytes (session.exportPdf()).

Usage (Kotlin Multiplatform)

DocumentEngine.open(bytes, hint = "avviso.docx").use { session ->
    val pageCount = session.pageCount
    val bitmap = session.renderPage(0, scale = 1.5f, theme = ReadingTheme.DARK)
    val hits = session.search("PagoPA")
    val pdfBytes = session.exportPdf()
}

Building Native Libraries

  • Android + Windows host tests: powershell -ExecutionPolicy Bypass -File scripts/build-native-android.ps1
  • iOS XCFramework (macOS): ./scripts/build-native-ios.sh
  • Publish locally: ./gradlew -PsdkVersion=1.0.0-local :testAndroidHostTest :publishAllPublicationsToStagingRepository :publishToMavenLocal

About

Kotlin Multiplatform + pure-Rust document engine SDK (PDF, Word, ODT, RTF, Markdown, HTML)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages