Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

barcode-pao-native

高性能バーコード生成ライブラリ for Python(C++ネイティブ拡張版)

概要

barcode-pao-native は、C++で実装されたバーコードライブラリをPythonから利用できるようにしたパッケージです。pybind11を使用してC++コードを直接呼び出すため、高速なバーコード生成が可能です。

対応バーコード(18種)

1次元バーコード(11種)

  • Code39 - 英数字対応の汎用バーコード
  • Code93 - Code39の拡張版
  • Code128 - 全ASCII文字対応の高密度バーコード
  • GS1-128 - 物流・流通向けバーコード(コンビニ収納代行対応)
  • NW-7 (Codabar) - 血液銀行・宅配便向けバーコード
  • Matrix 2 of 5 - 工業用バーコード
  • NEC 2 of 5 - NECが開発した2 of 5系バーコード
  • JAN-8 - 日本の商品コード(8桁)
  • JAN-13 - 日本の商品コード(13桁)
  • UPC-A - 北米の商品コード(12桁)
  • UPC-E - UPC-Aの短縮版(8桁)

GS1 DataBar(3種)

  • GS1 DataBar 14 - 標準型(オムニ/スタック対応)
  • GS1 DataBar Limited - 限定型
  • GS1 DataBar Expanded - 拡張型(スタック対応)

2次元バーコード(3種)

  • QRコード - 日本発の2次元コード
  • DataMatrix - 工業用途の2次元コード
  • PDF417 - 運転免許証等で使用される2次元コード

特殊バーコード(1種)

  • 郵便カスタマバーコード - 日本郵便の住所表示バーコード

インストール

pip install barcode-pao-native

使用例

QRコード生成

from barcode_pao_native import QR

# QRコードインスタンスを作成
qr = QR()

# エラー訂正レベルを設定(L/M/Q/H)
qr.set_error_correction_level("H")

# 日本語をエンコードする場合
qr.set_string_encoding("shift-jis")

# Base64エンコードされた画像を取得
base64_image = qr.draw("https://example.com", 200)

# バイナリデータとして取得
image_bytes = qr.draw_bytes("Hello, World!", 200)

# ファイルに保存
qr.draw_to_file("Hello, World!", 200, "qrcode.png")

Code128バーコード生成

from barcode_pao_native import Code128

# Code128インスタンスを作成
code128 = Code128()

# テキスト表示を有効化
code128.set_show_text(True)

# 出力フォーマットをSVGに設定
code128.set_output_format("svg")

# コードモードを設定(AUTO/A/B/C)
code128.set_code_mode("AUTO")

# バーコード生成
svg_data = code128.draw("ABC-12345", 300, 100)

色のカスタマイズ

from barcode_pao_native import Code39

code39 = Code39()

# 前景色(バーの色)をRGBAで設定
code39.set_foreground_color(0, 0, 128, 255)  # 紺色

# 背景色をRGBAで設定
code39.set_background_color(255, 255, 200, 255)  # 薄黄色

base64_image = code39.draw("12345", 200, 80)

GS1-128 コンビニ収納代行バーコード

from barcode_pao_native import GS1_128

gs1 = GS1_128()
gs1.set_show_text(True)

# 標準料金代理収納用バーコード
# 43桁または44桁の数字を指定
convenience_code = "9101234567890123456789012345678901234567890123"
base64_image = gs1.draw_convenience(convenience_code, 400, 100)

郵便カスタマバーコード

from barcode_pao_native import YubinCustomer

yubin = YubinCustomer()

# 郵便番号 + 住所表示番号
# 例: 〒100-0001 東京都千代田区1-2-3
code = "1000001-1-2-3"
base64_image = yubin.draw(code, 50)  # 高さのみ指定(幅は自動)

API リファレンス

共通メソッド(全バーコードクラス)

メソッド 説明
set_output_format(format) 出力フォーマットを設定("png", "jpg", "gif", "svg")
set_foreground_color(r, g, b, a=255) 前景色(バーの色)を設定
set_background_color(r, g, b, a=255) 背景色を設定
draw(code, width, height) Base64エンコードされた画像を返す
draw_bytes(code, width, height) バイナリデータを返す
draw_to_file(code, width, height, filepath) ファイルに保存

1次元バーコード固有メソッド

メソッド 説明
set_show_text(show) バーコード下のテキスト表示
set_text_font_scale(scale) テキストのフォントサイズスケール
set_text_gap(scale) バーとテキストの間隔
set_fit_width(fit) 幅に合わせてバーを調整
set_px_adjust_black(adjust) 黒バーのピクセル調整
set_px_adjust_white(adjust) 白バーのピクセル調整

2次元バーコード固有メソッド

クラス メソッド 説明
QR set_error_correction_level(level) エラー訂正レベル(L/M/Q/H)
QR set_version(version) バージョン(0=自動, 1-40)
QR set_encode_mode(mode) エンコードモード(NUMERIC/ALPHANUMERIC/BYTE/KANJI)
DataMatrix set_code_size(size) シンボルサイズ("AUTO", "10x10"など)
DataMatrix set_encode_scheme(scheme) エンコードスキーム(AUTO/ASCII/C40/TEXT/X12/EDIFACT/BASE256)
PDF417 set_error_level(level) エラー訂正レベル(-1=自動, 0-8)
PDF417 set_columns(columns) 列数
PDF417 set_rows(rows) 行数

出力フォーマット

フォーマット 説明
png PNG画像(デフォルト)
jpg / jpeg JPEG画像
gif GIF画像
svg SVGベクター画像

動作環境

  • Python 3.8以上
  • Windows / macOS / Linux

ライセンス

MIT License

関連パッケージ

Metadata

Release files for barcode-pao-native 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Built distributions (wheels)

Table of built distributions (wheels) for barcode-pao-native 1.1.3
File Actions
barcode_pao_native-1.1.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for barcode_pao_native-1.1.3-cp313-cp313-win_amd64.whl
barcode_pao_native-1.1.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for barcode_pao_native-1.1.3-cp312-cp312-win_amd64.whl
barcode_pao_native-1.1.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for barcode_pao_native-1.1.3-cp311-cp311-win_amd64.whl
barcode_pao_native-1.1.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for barcode_pao_native-1.1.3-cp310-cp310-win_amd64.whl
barcode_pao_native-1.1.3-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for barcode_pao_native-1.1.3-cp39-cp39-win_amd64.whl

Total release size: 10.2 MB

Release files / barcode_pao_native-1.1.3-cp313-cp313-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL barcode_pao_native-1.1.3-cp313-cp313-win_amd64.whl
Size 2.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
2b84fdca14a5e220f2e0e187782c3d5342bef29c1b1e239993e8361dc852c5e6
BLAKE2b-256 checksum
How to use checksums
100b67f1b977db5e5a0cd5d7570ebbd0c0a5f085c053a8c385f8e5c17f3a5efb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / barcode_pao_native-1.1.3-cp312-cp312-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL barcode_pao_native-1.1.3-cp312-cp312-win_amd64.whl
Size 2.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
31eb697d21f46b35a112952e205747315ee8ed3058ea8adc11baa23eee26e602
BLAKE2b-256 checksum
How to use checksums
a1a999452739a17a77c701befe9d086f0ef416c01dc8cde5b5a9710b57f2105b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / barcode_pao_native-1.1.3-cp311-cp311-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL barcode_pao_native-1.1.3-cp311-cp311-win_amd64.whl
Size 2.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
87c78b8076307ff3b7d4fbeaebc2c24ce9650b16d27221de4c34fdff56e05850
BLAKE2b-256 checksum
How to use checksums
7fc73e56046e833c628242f69682365632def63cccaf98b39a7745c492015737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / barcode_pao_native-1.1.3-cp310-cp310-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL barcode_pao_native-1.1.3-cp310-cp310-win_amd64.whl
Size 2.0 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
9e0e60ec65d634c1ecb80649a69577fe7413dfcca8e6580e5aa52fa8ed4e1ad1
BLAKE2b-256 checksum
How to use checksums
7a50347c93c1b1c8e5841daa6554ab792c5d9758007fe7b406a9b0c7a7053793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / barcode_pao_native-1.1.3-cp39-cp39-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL barcode_pao_native-1.1.3-cp39-cp39-win_amd64.whl
Size 2.0 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
ccb6cb07001d5f1d760b3a3671586e7a6b583fe4654e0f2f71f2a5dd023de829
BLAKE2b-256 checksum
How to use checksums
b624d6ab3873305e324314fa4c69f9d8d35bc8bf41b598d1c73d5520f7c9cb58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for barcode-pao-native 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 1.1.2 5 files With provenance
  • Added 1.1.3 5 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page