barcode_pao
Flutter デスクトップ(Windows/macOS)向けのバーコード生成ライブラリです。C++ のバーコードエンジン(ビルド済み)を dart:ffi で呼び出します。C++ のコンパイラーは要りません。
体験版です。 出力するバーコードに赤い「SAMPLE」の印が付きます(QR コードなど一部は、印のため読み取れないことがあります)。 製品版(印なし)は 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(郵便カスタマバーコード) |
対応プラットフォーム
Windows(x64)、macOS。
インストール
flutter pub add barcode_pao
使い方
import 'package:barcode_pao/barcode_pao.dart';
// Code128(PNG のデータ URL)
final code128 = Code128();
code128.setShowText(true);
final png = code128.draw('ABC-12345', 300, 100);
code128.dispose(); // 使い終わったら必ず解放
// QR コード(SVG)
final qr = QR();
qr.setOutputFormat('svg');
qr.setErrorCorrectionLevel('M');
final svg = qr.draw('https://www.pao.ac/', 200);
qr.dispose();
// GS1-128 コンビニ収納代行
final gs1 = GS1_128();
final conv = gs1.drawConvenience('9101234567890123456789012345678901234567890123', 400, 100);
gs1.dispose();
// 郵便カスタマバーコード(高さだけ指定)
final yubin = YubinCustomer();
final postal = yubin.draw('1000001-1-2-3', 50);
yubin.dispose();
draw は、PNG/JPEG のときは data:image/png;base64,... の形の文字列(データ URL)、SVG のときは SVG の文字列を返します。
主なメソッド
| 対象 | メソッド |
|---|---|
| 全クラス | setOutputFormat('png' / 'jpg' / 'svg')、setForegroundColor(r, g, b, [a])、setBackgroundColor(r, g, b, [a])、dispose() |
| 1 次元 | setShowText、setTextFontScale、setTextGap、setFitWidth、draw(code, width, height) |
| QR | setErrorCorrectionLevel('L'/'M'/'Q'/'H')、setVersion、setEncodeMode |
| DataMatrix | setCodeSize、setEncodeScheme |
| PDF417 | setErrorLevel、setColumns、setRows |
マニュアル:https://www.pao.ac/barcode.flutter/
ライセンス
MIT License(LICENSE)。体験版の印を消すには製品版のご購入が必要です。
barcode_pao (English)
Barcode generation for Flutter desktop apps (Windows / macOS). It calls a prebuilt C++ barcode engine through dart:ffi, so no C++ toolchain is needed.
Trial version. Every barcode carries a red "SAMPLE" mark (some symbols such as QR codes may not scan because of it). 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
Windows (x64) and macOS.
Install
flutter pub add barcode_pao
Usage
import 'package:barcode_pao/barcode_pao.dart';
final code128 = Code128();
code128.setShowText(true);
final pngBase64 = code128.draw('ABC-12345', 300, 100);
code128.dispose(); // always release native resources
final qr = QR();
qr.setOutputFormat('svg');
final svg = qr.draw('https://www.pao.ac/', 200);
qr.dispose();
draw returns a data URL (data:image/png;base64,...) for PNG/JPEG output, or an SVG string for SVG output.
License
MIT License (see LICENSE). Removing the trial mark requires the purchased product.
Libraries
- barcode_pao
- Barcode.Flutter Plugin版 - 高速バーコード生成ライブラリ