Skip to content

KitePDF 0.10.0

Choose a tag to compare

@yuroyami yuroyami released this 13 Sep 18:20

Some large EPUB books still made Android apps run out of memory after 0.9.0 (reported in #224). This release fixes that and about 90 smaller bugs where pages did not look right. Most of them were found by comparing KitePDF's pages with other readers. There is also a new, optional module that runs the JavaScript inside PDFs.

implementation("io.github.yuroyami:kitepdf:0.10.0")

Requirements

  • Kotlin 2.4.20+
  • JDK 21
  • Android SDK 37 / minSdk 21 (compose-viewer 24, native-renderer 29)
  • Compose Multiplatform 1.12.0 for kitepdf-compose-viewer
  • Pulls in KiteImage 0.1.0, Ktor 3.5.2 (kitepdf-net), Skiko 0.150.1 (renderers), KiteJS 0.1.0 (kitepdf-javascript)
  • Targets: Android, JVM, iOS, tvOS, watchOS, macOS, Linux, Windows, Android Native, JS, Wasm (kitepdf-javascript has no tvOS, watchOS, Android Native or wasmWasi build)

Fixed

  • Out of memory on large EPUBs (fixes #224, reported by @Tulis12). The book repeats the same font in every chapter, and KitePDF loaded a new copy each time. Now each font loads once per book. That book went from 340 MB of memory to 32 MB (#228).
  • Wrong colours in PDFs. Some colours came out black, grey or yellowish, and some artwork was hidden under white boxes (#76, #81, #82, #83, #84, #115, #147).
  • One broken part could ruin a whole page. A single bad piece of a PDF could stop the page from drawing, or shift and hide everything drawn after it. Now only the broken part is affected (#47, #48, #49, #50, #51, #52, #128, #149, #151, #152, #166).
  • Show/hide layers. Some PDFs let you turn parts of a page on and off. Hidden parts sometimes showed, visible parts sometimes disappeared, and one kind of broken file crashed the app (#53, #54, #55, #56, #58).
  • Comments, stamps and highlights. Unchecked checkboxes looked checked, hidden notes were shown, stamps were stretched, and highlights covered the text under them. Outlines now use their real thickness and dash style (#59, #60, #61, #62, #63, #64, #163, #165).
  • Text. Some text did not show at all, and some was covered by black boxes. Text whose font is not inside the file had the wrong spacing (#86, #87, #120, #139, #141, #142, #144, #145, #146).
  • Lines. Dashed and dotted lines drew solid or with the wrong dashes, and some line ends were wrong (#106, #107, #134, #135, #136, #137).
  • See-through areas. Transparent parts came out too dark where shapes overlap, blocky at soft edges, fully solid, or in the wrong place (#65, #66, #67, #73, #74, #75, #138, #162).
  • Gradients and repeating patterns. Gradients looked banded or spilled outside their area. Repeating patterns lost their transparency or filled the whole shape (#95, #148, #153, #154, #155, #156, #157, #158).
  • SVG images. Some drew upside down, stretched, or at three quarters of their real size. Dashed lines, outlines, spaces between words, see-through groups and cut-out shapes were also wrong in some files (#90, #91, #92, #96, #97, #98, #173, #174, #175, #176, #178, #182).
  • EPUB layout. Scene-break lines were missing, and fixed-layout books (like picture books) drew at 75% of their size. Images were too big, always centred, or missing when placed right after a word. Right-to-left books had list bullets and alignment on the wrong side, and a link around a picture could not be tapped (#99, #102, #111, #112, #167, #169, #171, #214).
  • Comics. WebP pages were blank and had the wrong size. WebP and TIFF pages now open at their real size. Lossy WebP pages still do not show (#129, #183).
  • Compose viewer. Creating a ReaderTheme inside a composable made the viewer redraw every page on each recomposition (#186).
  • Security alert about a JavaScript tool that only our tests use. That tool was never part of what you download (fixes #222, reported by @begininvoke).

Added

kitepdf-javascript, a new optional module. Some PDFs contain small scripts, for example one that shows a message when the file opens. This module runs them with KiteJS. For now a script can show a message and write to a log. Forms that fill in and calculate themselves come later (#236). A script that never ends is stopped, so it cannot freeze your app.

implementation("io.github.yuroyami:kitepdf-javascript:0.10.0")

PdfScriptRunner(doc, onAlert = { message -> showDialog(message) }).use { runner ->
    runner.runDocumentScripts()
}
  • EpubSettings(hyphenate = true) turns word hyphenation on for the whole book, and false turns it off, whatever the book's own styles say (fixes #24, requested by @ksokolovskiy).
  • page.renderTo(canvas, matrix, annotations = { false }) draws a PDF page without its comments, stamps and highlights, for printing or clean thumbnails (fixes #133).
  • PdfAnnotation has four new properties: isInvisible, isNoZoom, borderStyle and borderDash.

Some public classes gained constructor parameters, EpubSettings and PdfAnnotation among them. Your code compiles as it is, but a library built against 0.9.0 has to be rebuilt.

Full changelog: v0.9.0...v0.10.0