flutter_rhwp 2026.5.24 copy "flutter_rhwp: ^2026.5.24" to clipboard
flutter_rhwp: ^2026.5.24 copied to clipboard

Flutter bindings and widgets for rhwp.

flutter_rhwp #

Flutter bindings and widgets for HWP/HWPX documents, built with flutter_rust_bridge v2.

Repository: JAICHANGPARK/flutter_rhwp

Rust core: upstream edwardkim/rhwp, vendored at v0.7.12 for reproducible plugin builds.

Status #

This package is an initial plugin scaffold. It already wires Flutter to a vendored rhwp v0.7.12 Rust crate through FRB opaque sessions.

Implemented:

  • Open HWP/HWPX bytes.
  • Read page count and document metadata.
  • Render pages as SVG.
  • Read page layer tree JSON.
  • Extract text and Markdown.
  • Export HWP, HWPX, native PDF, and DOCX.
  • Apply basic edit commands for body text insert/delete and file name updates.
  • Display pages with RhwpViewer.
  • Edit through an initial RhwpEditor command overlay.
  • Example app workflows for opening the bundled asset sample or a picked HWP/HWPX file, then saving HWP/HWPX/PDF/DOCX/TXT/MD.

Not complete yet:

  • DOCX export currently maps extracted text into paragraph-oriented OOXML. Table, image, and exact layout mapping are still pending.
  • PDF export on Web/WASM throws RhwpUnsupportedPlatformException.
  • Web requires the FRB WASM build step and generated pkg/ output.
  • Editor UI is not implemented beyond command application.

Usage #

import 'dart:io';

import 'package:flutter_rhwp/flutter_rhwp.dart';

final bytes = await File('sample.hwp').readAsBytes();
final document = await Rhwp.open(bytes, fileName: 'sample.hwp');

final pageCount = await document.pageCount;
final firstPageSvg = await document.renderPageSvg(0);
final text = await document.extractText();
final hwpBytes = await document.export(RhwpExportFormat.hwp);

await document.close();

Viewer:

RhwpViewer(document: document)

Editor:

RhwpEditor(document: document)

Editing command:

await document.apply(
  RhwpCommand.insertText(
    section: 0,
    paragraph: 0,
    offset: 0,
    text: 'Hello',
  ),
);

Rust #

The Rust crate lives in rust/. The pinned upstream source is vendored at rust/vendor/rhwp, so normal builds do not fetch rhwp from GitHub.

Regenerate bridge code after changing rust/src/api:

flutter_rust_bridge_codegen generate

Build the example Web WASM bundle:

rustup target add wasm32-unknown-unknown
rustup component add rust-src --toolchain nightly
cargo install wasm-pack --locked
flutter_rust_bridge_codegen build-web --dart-root . --rust-root rust -o "$PWD/example/web"
(cd example && flutter build web)

Use an absolute -o path, or a path relative to rust/, because wasm-pack resolves the output directory from the Rust crate root.

Run checks:

cargo check --manifest-path rust/Cargo.toml
cargo test --manifest-path rust/Cargo.toml
flutter analyze
flutter test
(cd example && flutter test)

The example app adds file_picker for user-selected file open/save flows. On macOS the example enables user-selected read/write sandbox entitlement.