Skip to content

KitePDF 0.7.0

Choose a tag to compare

@yuroyami yuroyami released this 24 Aug 22:39
· 727 commits to main since this release

Redaction no longer leaves the removed content inside the file. Big EPUBs open instantly instead of paginating first. EPUB page numbering changed, so read the breaking section before upgrading.

implementation("io.github.yuroyami:kitepdf-pdf:0.7.0")

Requirements

  • Kotlin 2.4.10+ (older compilers cannot read these artifacts)
  • JDK 21
  • Android SDK 37 / minSdk 21 (compose-viewer 24, native-renderer 29)
  • Compose Multiplatform 1.12.0-beta02 for kitepdf-compose-viewer
  • Pulls in KiteImage 0.1.0, Ktor 3.5.2 (kitepdf-net), Skiko 0.148.2 (renderers)
  • Targets: Android, JVM, iOS, tvOS, watchOS, macOS, Linux, Windows, Android Native, JS, Wasm

⚠️ Breaking

Every chapter now starts on a fresh page. Page counts rise by roughly one per chapter boundary.

EpubDocument.outline no longer paginates the whole book just to build the table of contents. Navigate by target instead:

// before
state.goToPage(entry.pageIndex)

// after
entry.target?.let { state.goTo(it) }   // pageIndex fills in once laid out

KiteDocViewState.currentPage counts slots, not pages, while a reflowable book is still being laid out. For an exact position, use:

val exact = state.currentLocation   // KiteLocation(chapter, page)
val saved = doc.bookmarkOf(exact)   // survives a re-flow

A font declared inside one document's own <style> block now belongs to that document only, not to the whole book. Fonts declared in a shared stylesheet are still book-wide.

Redaction

Redacting two areas on one page only removed the second. The first area's content stayed in the file.

val editor = doc.edit()
editor.redactRegion(doc.pages[0], KiteRectangle(100.0, 600.0, 300.0, 650.0))
editor.redactRegion(doc.pages[0], KiteRectangle(100.0, 400.0, 300.0, 450.0))
val bytes = editor.saveRewritten()   // 0.6.3: region 1 survives. 0.7.0: both gone.

Also fixed in the same release:

  • A shape drawn in several spots (a form XObject) is now redacted per spot. Rewriting it once under-redacted the others and destroyed content that was never in a region
  • A redacted form field kept its value. It is now detached from the document's form
  • Vector art survived under the black box. Paths whose ink reaches a region are now removed, allowing for line width and corner joins. A drawn signature used to sit under the box with its coordinates intact
  • Removed objects could be recovered. They are now emptied, not just unlinked, so a leftover reference cannot restore them

saveRewritten() is still required. saveIncremental() refuses after a redaction.

EPUB

Footnote links landed at the top of the notes file instead of on the note (fixes #4, reported by @ksokolovskiy). The markup that broke it:

<a href="ch2.xhtml#id33">[2]</a>
...
<span id="id33"><div>2</div><p>the note</p></span>

An inline element wrapping block children collapsed into one paragraph, so the id anchored to the enclosing block. pageOf("ch2.xhtml#id33") now returns the note's page.

Big books open at your last reading position instead of laying out the whole book first (fixes #3, reported by @ksokolovskiy). A 9.9 MB book: 986 ms to first page before, 3 ms now.

Rendering

Rotation, cropping, page origins and custom page units (/Rotate, /CropBox, MediaBox origins, /UserUnit) now work on the AWT, Android and Apple rasterizers, not only Skia. A page rotated 90 degrees came out the wrong shape.

Images wrapped in an extra encoding layer now decode, for example:

/Filter [/ASCII85Decode /DCTDecode]

Known limits

  • The non-JVM renderers do not yet draw everything the JVM and Skia renderers do
  • Redaction does not handle sh shadings. A large flat fill whose edges lie outside every redacted region survives

Full changelog: v0.6.3...v0.7.0