barcode_pao_wasm 1.2.3
barcode_pao_wasm: ^1.2.3 copied to clipboard
Barcode generation for Flutter Web with a C++ WebAssembly engine (bundled). QR, DataMatrix, PDF417, Code128, GS1-128, GS1 DataBar, JAN, UPC, Japanese postal barcode and more. Trial version: output car [...]
barcode_pao_wasm #
Flutter Web 向けのバーコード生成ライブラリです。C++ のバーコードエンジンを WebAssembly にしたもの(wasm/barcode.js・wasm/barcode.wasm)を同梱しています。index.html の変更は要りません。
体験版です。 出力するバーコードに赤い「SAMPLE」の印が付きます。 製品版(印なし)は Barcode.Flutter をご購入ください。
English follows the Japanese section.
対応バーコード #
| 種類 | クラス |
|---|---|
| 1 次元 | Code39、Code93、Code128、GS1_128(コンビニ収納代行を含む)、NW7、ITF、Matrix2of5、NEC2of5、Jan8、Jan13、UPC_A、UPC_E |
| GS1 DataBar | GS1DataBar14、GS1DataBarLimited、GS1DataBarExpanded |
| 2 次元 | QR、DataMatrix、PDF417 |
| 郵便 | YubinCustomer(郵便カスタマバーコード) |
対応プラットフォーム #
Web のみ。Windows・macOS のアプリには barcode_pao(ネイティブ版)をお使いください。
インストール #
flutter pub add barcode_pao_wasm
使い方 #
import 'package:barcode_pao_wasm/barcode_pao_wasm.dart';
Future<void> main() async {
// アプリの起動時に 1 回だけ(同梱のエンジンを読み込みます)
await initBarcodeWasm();
// Code128(PNG のデータ URL)
final code128 = Code128()..setShowText(true);
final png = code128.draw('ABC-12345', 300, 100);
// QR コード(SVG)
final qr = QR()
..setOutputFormat('svg')
..setErrorCorrectionLevel('M');
final svg = qr.draw('https://www.pao.ac/', 200);
}
draw は、PNG/JPEG のときは data:image/png;base64,... の形の文字列(データ URL)、SVG のときは SVG の文字列を返します。
主なメソッド #
| 対象 | メソッド |
|---|---|
| 全クラス | setOutputFormat('png' / 'jpg' / 'svg')、setForegroundColor(r, g, b, [a])、setBackgroundColor(r, g, b, [a]) |
| 1 次元 | setShowText、setTextFontScale、setTextGap、setFitWidth、draw(code, width, height) |
| QR | setErrorCorrectionLevel('L'/'M'/'Q'/'H')、setVersion、setEncodeMode |
| DataMatrix | setCodeSize、setEncodeScheme |
| PDF417 | setErrorLevel、setColumns、setRows |
| GS1-128 | drawConvenience(code, width, height)(コンビニ収納代行) |
ページ側で window.Module を用意している場合は、そちらを使います。
マニュアル:https://www.pao.ac/barcode.flutter/
ライセンス #
MIT License(LICENSE)。体験版の印を消すには製品版のご購入が必要です。
barcode_pao_wasm (English) #
Barcode generation for Flutter Web. The C++ barcode engine compiled to WebAssembly (wasm/barcode.js, wasm/barcode.wasm) is bundled as package assets, so no index.html changes are needed.
Trial version. Every barcode carries a red "SAMPLE" mark. The full version without the mark is available at Barcode.Flutter.
Supported symbologies #
Code39, Code93, Code128, GS1-128 (incl. Japanese convenience-store payment), NW-7 (Codabar), ITF, Matrix 2 of 5, NEC 2 of 5, JAN-8, JAN-13, UPC-A, UPC-E, GS1 DataBar (14 / Limited / Expanded), QR Code, DataMatrix, PDF417 and the Japanese postal customer barcode.
Platforms #
Web only. For Windows and macOS apps use barcode_pao.
Install #
flutter pub add barcode_pao_wasm
Usage #
import 'package:barcode_pao_wasm/barcode_pao_wasm.dart';
Future<void> main() async {
await initBarcodeWasm(); // once at startup; loads the bundled engine
final code128 = Code128()..setShowText(true);
final pngDataUrl = code128.draw('ABC-12345', 300, 100);
final qr = QR()..setOutputFormat('svg');
final svg = qr.draw('https://www.pao.ac/', 200);
}
draw returns a data URL (data:image/png;base64,...) for PNG/JPEG output, or an SVG string for SVG output. If the page defines window.Module, that engine is used instead.
License #
MIT License (see LICENSE). Removing the trial mark requires the purchased product.