Releases: bettongia/pdfium
Release list
0.1.0 — first stable release
The first stable release of betto_pdfium and its iOS companion plugin
betto_pdfium_ios.
betto_pdfium is a pure Dart wrapper around
PDFium via dart:ffi. There is no
dependency on dart:ui or Flutter, so it works in CLI tools, server-side Dart,
and Flutter apps alike. Pre-built PDFium binaries
(bblanchon/pdfium-binaries
chromium/7906) are downloaded automatically by the native-assets build hook on
first use — no C++ toolchain required.
There are no functional changes since 0.1.0-dev.4; this release promotes the
dev channel to a stable version. The notes below summarise everything that
landed across 0.1.0-dev.1 → 0.1.0.
Installation
dependencies:
betto_pdfium: ^0.1.0Flutter iOS apps also need the companion plugin, which delivers the PDFium
xcframework via Swift Package Manager:
dependencies:
betto_pdfium: ^0.1.0
betto_pdfium_ios: ^0.1.0Platform support
All eight targets are supported:
| Platform | Status |
|---|---|
| macOS arm64 | Supported |
| Linux x86_64 | Supported |
| Linux arm64 | Supported |
| Windows x86_64 | Supported |
| iOS arm64 | Supported (xcframework) |
| Android arm64 | Supported |
| Android x86_64 | Supported |
| Web (WASM) | Supported |
On desktop the binary is fetched automatically on the first dart test or
dart run. On iOS the xcframework arrives through SPM during flutter pub get.
Web requires make fetch_wasm_assets to stage the WASM/JS artifacts — see the
package README.
API surface
Everything hangs off PdfDocument:
- Document loading —
PdfDocument.fromBytes()loads into a background
isolate so the calling isolate is never blocked.PdfExtractionException
distinguishesPdfError.passwordRequiredfromPdfError.invalidDocument.
close()releases the native handle and is safe to call more than once. - Metadata —
getMetadata()(title, author, subject, keywords, creator,
producer, creation/modification dates),getDocumentInfo()(file version,
permanent/changing IDs), andpageCount. - Text extraction —
extractPlainText()streamsPdfPageTextper page with
hasTextLayerandhasUnicodeErrorsflags;isPlainTextExtractable()gives
a quick scanned-document check. - Rendering —
renderPageToBytes()produces a raw BGRA pixel buffer, with
optional annotation rendering, LCD text, and background colour.
getPageSize()returns dimensions in points plussizeForDpi(). - Annotations —
extractAnnotations()streams typed annotations: text,
markup (highlight/underline/squiggly/strikeout, withquadPoints), free text,
ink, shape, popup, and stamp. - Images —
extractImages()streams image objects with bounding boxes and
metadata, optionally with bitmaps;renderImage()fetches a single image's
BGRA bitmap on demand. - Search —
search()streams matches with page index, character index, and
rects in PDF user space; supports case, whole-word, and consecutive flags. - Table of contents —
tableOfContentsreturns the full nested bookmark
tree. - Thumbnails —
getThumbnail()returns the embedded/Thumbstream when
present, or a rendered fallback at a requested maximum dimension. pdfinfoCLI —dart run bin/pdfinfo.dartinspects metadata, document
info, page count, table of contents, and text extractability.
Streams are fully cancellable — cancelling or calling close() stops processing
immediately with no native handle leaks.
Architecture notes
- PDFium is not thread-safe, so all calls run on a single process-wide isolate
(PdfiumIsolate), lazily spawned and shared by everyPdfDocument. - On web,
dart:isolateis unavailable, so the same concurrency model is
implemented with a dedicated Web Worker and apostMessageprotocol. Large
document operations do not block the browser main thread. - Rendering returns raw BGRA bytes rather than a
dart:uiImage, keeping the
rendering surface usable outside Flutter.
Notable fixes in the dev channel
- Native library resolution in a Pub workspace (
dev.4) — when running from
a workspace member package, the native-assets pipeline stages the library to
the workspace root.dart_tool/lib/. The loader now walks up from the
working directory probing each ancestor, covering both single-package and
workspace layouts on Linux, macOS, and Windows. - Dart 3.13 support (
dev.4) — SDK constraint raised to^3.13.0, verified
end-to-end against the 3.13 native-assets pipeline on macOS, Linux (x64 and
arm64), and Windows.
Quality
608 tests passing at 96.2% line coverage.
Documentation
- Package README:
packages/betto_pdfium/README.md - Full specification and API docs: https://bettongia.github.io/pdfium
- Changelog:
packages/betto_pdfium/CHANGELOG.md
Packages on pub.dev
bblanchon chromium/7906 (iOS xcframework)
Repacked iOS xcframework from bblanchon/pdfium-binaries chromium/7906.
Source tarballs:
- pdfium-ios-device-arm64.tgz
- pdfium-ios-simulator-arm64.tgz
SHA-256 of pdfium.xcframework.zip: 26595793be1323fcb887941b4111cde53050ce13284b0573058861ee298fddd9