Idiomatic Dart bindings over the pdf_oxide C ABI via dart:ffi. The native
library (libpdf_oxide.{so,dylib,dll}) is loaded at runtime; handles are freed
by a NativeFinalizer (and explicit close()); C strings/buffers are copied
into Dart and freed for you; C-ABI error codes are thrown as PdfOxideError.
Published to pub.dev as pdf_oxide:
dart pub add pdf_oxide# or in pubspec.yaml
dependencies:
pdf_oxide: ^0.3.69The native libpdf_oxide.{so,dylib,dll} is loaded at runtime and is not
bundled — see "Setup" for building it and pointing the loader at it.
The binding links the default-feature cdylib (not the Python wheel):
# 1. build the native library (shipped binding feature set)
cargo build --release --lib --features ocr,rendering,signatures,barcodes,tsa-client,system-fonts
# 2. install deps + run tests (point the loader at the cdylib)
cd dart
dart pub get
PDF_OXIDE_LIB_DIR="$PWD/../target/release" dart test
PDF_OXIDE_LIB_DIR="$PWD/../target/release" dart run example/basic_extraction.dartNative library resolution order: PDF_OXIDE_LIB_PATH (full path) →
PDF_OXIDE_LIB_DIR → ../target/release → target/release → system loader.
For Flutter, ship the platform library and set PDF_OXIDE_LIB_PATH.
import 'package:pdf_oxide/pdf_oxide.dart';
void main() {
final pdf = Pdf.fromMarkdown('# Hello\n\nbody\n');
final doc = PdfDocument.openFromBytes(pdf.toBytes());
try {
print('pages: ${doc.pageCount}');
print(doc.extractText(0));
print(doc.toMarkdownAll());
} finally {
doc.close();
pdf.close();
}
}dart/
lib/pdf_oxide.dart dart:ffi wrapper (PdfDocument, Pdf, PdfOxideError)
example/basic_extraction.dart runnable example (asserted in CI)
test/api_coverage_test.dart one test per public method
pubspec.yaml
.github/workflows/dart.yml on Linux + macOS: build cdylib → dart pub get →
dart analyze → dart format check → dart test (api-coverage) → run example
with an output assertion.