barcode-pao-native 1.0.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- barcode_pao_native/SDL2.dll +0 -0
- barcode_pao_native/SDL2_image.dll +0 -0
- barcode_pao_native/SDL2_ttf.dll +0 -0
- barcode_pao_native/__init__.py +84 -0
- barcode_pao_native/_barcode_pao_native.cp311-win_amd64.pyd +0 -0
- barcode_pao_native-1.0.0.dist-info/METADATA +222 -0
- barcode_pao_native-1.0.0.dist-info/RECORD +9 -0
- barcode_pao_native-1.0.0.dist-info/WHEEL +5 -0
- barcode_pao_native-1.0.0.dist-info/top_level.txt +1 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
barcode-pao-native: High-performance barcode generation library for Python
|
|
3
|
+
|
|
4
|
+
This package provides Python bindings for a C++ barcode library using pybind11.
|
|
5
|
+
Supports 18 barcode types including 1D, 2D, and special barcodes.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
>>> from barcode_pao_native import QR, Code39
|
|
9
|
+
>>>
|
|
10
|
+
>>> # Generate QR code
|
|
11
|
+
>>> qr = QR()
|
|
12
|
+
>>> qr.set_error_correction_level("H")
|
|
13
|
+
>>> base64_image = qr.draw("Hello, World!", 200)
|
|
14
|
+
>>>
|
|
15
|
+
>>> # Generate Code39 barcode
|
|
16
|
+
>>> code39 = Code39()
|
|
17
|
+
>>> code39.set_show_text(True)
|
|
18
|
+
>>> base64_image = code39.draw("12345", 200, 100)
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from ._barcode_pao_native import (
|
|
22
|
+
# 1D Barcodes
|
|
23
|
+
Code39,
|
|
24
|
+
Code93,
|
|
25
|
+
Code128,
|
|
26
|
+
GS1_128,
|
|
27
|
+
NW7,
|
|
28
|
+
Matrix2of5,
|
|
29
|
+
NEC2of5,
|
|
30
|
+
Jan8,
|
|
31
|
+
Jan13,
|
|
32
|
+
UPC_A,
|
|
33
|
+
UPC_E,
|
|
34
|
+
|
|
35
|
+
# GS1 DataBar
|
|
36
|
+
GS1DataBar14,
|
|
37
|
+
GS1DataBarLimited,
|
|
38
|
+
GS1DataBarExpanded,
|
|
39
|
+
|
|
40
|
+
# 2D Barcodes
|
|
41
|
+
QR,
|
|
42
|
+
DataMatrix,
|
|
43
|
+
PDF417,
|
|
44
|
+
|
|
45
|
+
# Special
|
|
46
|
+
YubinCustomer,
|
|
47
|
+
|
|
48
|
+
# Product Info
|
|
49
|
+
ProductInfo,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
__version__ = "1.0.0"
|
|
53
|
+
__author__ = "Pao"
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
# 1D Barcodes
|
|
57
|
+
"Code39",
|
|
58
|
+
"Code93",
|
|
59
|
+
"Code128",
|
|
60
|
+
"GS1_128",
|
|
61
|
+
"NW7",
|
|
62
|
+
"Matrix2of5",
|
|
63
|
+
"NEC2of5",
|
|
64
|
+
"Jan8",
|
|
65
|
+
"Jan13",
|
|
66
|
+
"UPC_A",
|
|
67
|
+
"UPC_E",
|
|
68
|
+
|
|
69
|
+
# GS1 DataBar
|
|
70
|
+
"GS1DataBar14",
|
|
71
|
+
"GS1DataBarLimited",
|
|
72
|
+
"GS1DataBarExpanded",
|
|
73
|
+
|
|
74
|
+
# 2D Barcodes
|
|
75
|
+
"QR",
|
|
76
|
+
"DataMatrix",
|
|
77
|
+
"PDF417",
|
|
78
|
+
|
|
79
|
+
# Special
|
|
80
|
+
"YubinCustomer",
|
|
81
|
+
|
|
82
|
+
# Product Info
|
|
83
|
+
"ProductInfo",
|
|
84
|
+
]
|
|
Binary file
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: barcode-pao-native
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: High-performance barcode generation library for Python (Native C++ Extension)
|
|
5
|
+
Home-page: https://github.com/pao-ac/barcode-pao-native
|
|
6
|
+
Author: Pao
|
|
7
|
+
Author-email: Pao <info@pao.ac>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/pao-ac/barcode-pao-native
|
|
10
|
+
Project-URL: Documentation, https://github.com/pao-ac/barcode-pao-native#readme
|
|
11
|
+
Project-URL: Repository, https://github.com/pao-ac/barcode-pao-native
|
|
12
|
+
Project-URL: Issues, https://github.com/pao-ac/barcode-pao-native/issues
|
|
13
|
+
Keywords: barcode,qr,code128,code39,datamatrix,pdf417,ean,jan,upc,gs1
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: C++
|
|
25
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
|
|
33
|
+
# barcode-pao-native
|
|
34
|
+
|
|
35
|
+
高性能バーコード生成ライブラリ for Python(C++ネイティブ拡張版)
|
|
36
|
+
|
|
37
|
+
## 概要
|
|
38
|
+
|
|
39
|
+
`barcode-pao-native` は、C++で実装されたバーコードライブラリをPythonから利用できるようにしたパッケージです。pybind11を使用してC++コードを直接呼び出すため、高速なバーコード生成が可能です。
|
|
40
|
+
|
|
41
|
+
## 対応バーコード(18種)
|
|
42
|
+
|
|
43
|
+
### 1次元バーコード(11種)
|
|
44
|
+
- **Code39** - 英数字対応の汎用バーコード
|
|
45
|
+
- **Code93** - Code39の拡張版
|
|
46
|
+
- **Code128** - 全ASCII文字対応の高密度バーコード
|
|
47
|
+
- **GS1-128** - 物流・流通向けバーコード(コンビニ収納代行対応)
|
|
48
|
+
- **NW-7 (Codabar)** - 血液銀行・宅配便向けバーコード
|
|
49
|
+
- **Matrix 2 of 5** - 工業用バーコード
|
|
50
|
+
- **NEC 2 of 5** - NECが開発した2 of 5系バーコード
|
|
51
|
+
- **JAN-8** - 日本の商品コード(8桁)
|
|
52
|
+
- **JAN-13** - 日本の商品コード(13桁)
|
|
53
|
+
- **UPC-A** - 北米の商品コード(12桁)
|
|
54
|
+
- **UPC-E** - UPC-Aの短縮版(8桁)
|
|
55
|
+
|
|
56
|
+
### GS1 DataBar(3種)
|
|
57
|
+
- **GS1 DataBar 14** - 標準型(オムニ/スタック対応)
|
|
58
|
+
- **GS1 DataBar Limited** - 限定型
|
|
59
|
+
- **GS1 DataBar Expanded** - 拡張型(スタック対応)
|
|
60
|
+
|
|
61
|
+
### 2次元バーコード(3種)
|
|
62
|
+
- **QRコード** - 日本発の2次元コード
|
|
63
|
+
- **DataMatrix** - 工業用途の2次元コード
|
|
64
|
+
- **PDF417** - 運転免許証等で使用される2次元コード
|
|
65
|
+
|
|
66
|
+
### 特殊バーコード(1種)
|
|
67
|
+
- **郵便カスタマバーコード** - 日本郵便の住所表示バーコード
|
|
68
|
+
|
|
69
|
+
## インストール
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install barcode-pao-native
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 使用例
|
|
76
|
+
|
|
77
|
+
### QRコード生成
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from barcode_pao_native import QR
|
|
81
|
+
|
|
82
|
+
# QRコードインスタンスを作成
|
|
83
|
+
qr = QR()
|
|
84
|
+
|
|
85
|
+
# エラー訂正レベルを設定(L/M/Q/H)
|
|
86
|
+
qr.set_error_correction_level("H")
|
|
87
|
+
|
|
88
|
+
# 日本語をエンコードする場合
|
|
89
|
+
qr.set_string_encoding("shift-jis")
|
|
90
|
+
|
|
91
|
+
# Base64エンコードされた画像を取得
|
|
92
|
+
base64_image = qr.draw("https://example.com", 200)
|
|
93
|
+
|
|
94
|
+
# バイナリデータとして取得
|
|
95
|
+
image_bytes = qr.draw_bytes("Hello, World!", 200)
|
|
96
|
+
|
|
97
|
+
# ファイルに保存
|
|
98
|
+
qr.draw_to_file("Hello, World!", 200, "qrcode.png")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Code128バーコード生成
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from barcode_pao_native import Code128
|
|
105
|
+
|
|
106
|
+
# Code128インスタンスを作成
|
|
107
|
+
code128 = Code128()
|
|
108
|
+
|
|
109
|
+
# テキスト表示を有効化
|
|
110
|
+
code128.set_show_text(True)
|
|
111
|
+
|
|
112
|
+
# 出力フォーマットをSVGに設定
|
|
113
|
+
code128.set_output_format("svg")
|
|
114
|
+
|
|
115
|
+
# コードモードを設定(AUTO/A/B/C)
|
|
116
|
+
code128.set_code_mode("AUTO")
|
|
117
|
+
|
|
118
|
+
# バーコード生成
|
|
119
|
+
svg_data = code128.draw("ABC-12345", 300, 100)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 色のカスタマイズ
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from barcode_pao_native import Code39
|
|
126
|
+
|
|
127
|
+
code39 = Code39()
|
|
128
|
+
|
|
129
|
+
# 前景色(バーの色)をRGBAで設定
|
|
130
|
+
code39.set_foreground_color(0, 0, 128, 255) # 紺色
|
|
131
|
+
|
|
132
|
+
# 背景色をRGBAで設定
|
|
133
|
+
code39.set_background_color(255, 255, 200, 255) # 薄黄色
|
|
134
|
+
|
|
135
|
+
base64_image = code39.draw("12345", 200, 80)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### GS1-128 コンビニ収納代行バーコード
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from barcode_pao_native import GS1_128
|
|
142
|
+
|
|
143
|
+
gs1 = GS1_128()
|
|
144
|
+
gs1.set_show_text(True)
|
|
145
|
+
|
|
146
|
+
# 標準料金代理収納用バーコード
|
|
147
|
+
# 43桁または44桁の数字を指定
|
|
148
|
+
convenience_code = "9101234567890123456789012345678901234567890123"
|
|
149
|
+
base64_image = gs1.draw_convenience(convenience_code, 400, 100)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 郵便カスタマバーコード
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from barcode_pao_native import YubinCustomer
|
|
156
|
+
|
|
157
|
+
yubin = YubinCustomer()
|
|
158
|
+
|
|
159
|
+
# 郵便番号 + 住所表示番号
|
|
160
|
+
# 例: 〒100-0001 東京都千代田区1-2-3
|
|
161
|
+
code = "1000001-1-2-3"
|
|
162
|
+
base64_image = yubin.draw(code, 50) # 高さのみ指定(幅は自動)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## API リファレンス
|
|
166
|
+
|
|
167
|
+
### 共通メソッド(全バーコードクラス)
|
|
168
|
+
|
|
169
|
+
| メソッド | 説明 |
|
|
170
|
+
|---------|------|
|
|
171
|
+
| `set_output_format(format)` | 出力フォーマットを設定("png", "jpg", "gif", "svg")|
|
|
172
|
+
| `set_foreground_color(r, g, b, a=255)` | 前景色(バーの色)を設定 |
|
|
173
|
+
| `set_background_color(r, g, b, a=255)` | 背景色を設定 |
|
|
174
|
+
| `draw(code, width, height)` | Base64エンコードされた画像を返す |
|
|
175
|
+
| `draw_bytes(code, width, height)` | バイナリデータを返す |
|
|
176
|
+
| `draw_to_file(code, width, height, filepath)` | ファイルに保存 |
|
|
177
|
+
|
|
178
|
+
### 1次元バーコード固有メソッド
|
|
179
|
+
|
|
180
|
+
| メソッド | 説明 |
|
|
181
|
+
|---------|------|
|
|
182
|
+
| `set_show_text(show)` | バーコード下のテキスト表示 |
|
|
183
|
+
| `set_text_font_scale(scale)` | テキストのフォントサイズスケール |
|
|
184
|
+
| `set_text_gap(scale)` | バーとテキストの間隔 |
|
|
185
|
+
| `set_fit_width(fit)` | 幅に合わせてバーを調整 |
|
|
186
|
+
| `set_px_adjust_black(adjust)` | 黒バーのピクセル調整 |
|
|
187
|
+
| `set_px_adjust_white(adjust)` | 白バーのピクセル調整 |
|
|
188
|
+
|
|
189
|
+
### 2次元バーコード固有メソッド
|
|
190
|
+
|
|
191
|
+
| クラス | メソッド | 説明 |
|
|
192
|
+
|--------|---------|------|
|
|
193
|
+
| QR | `set_error_correction_level(level)` | エラー訂正レベル(L/M/Q/H)|
|
|
194
|
+
| QR | `set_version(version)` | バージョン(0=自動, 1-40)|
|
|
195
|
+
| QR | `set_encode_mode(mode)` | エンコードモード(NUMERIC/ALPHANUMERIC/BYTE/KANJI)|
|
|
196
|
+
| DataMatrix | `set_code_size(size)` | シンボルサイズ("AUTO", "10x10"など)|
|
|
197
|
+
| DataMatrix | `set_encode_scheme(scheme)` | エンコードスキーム(AUTO/ASCII/C40/TEXT/X12/EDIFACT/BASE256)|
|
|
198
|
+
| PDF417 | `set_error_level(level)` | エラー訂正レベル(-1=自動, 0-8)|
|
|
199
|
+
| PDF417 | `set_columns(columns)` | 列数 |
|
|
200
|
+
| PDF417 | `set_rows(rows)` | 行数 |
|
|
201
|
+
|
|
202
|
+
## 出力フォーマット
|
|
203
|
+
|
|
204
|
+
| フォーマット | 説明 |
|
|
205
|
+
|-------------|------|
|
|
206
|
+
| `png` | PNG画像(デフォルト)|
|
|
207
|
+
| `jpg` / `jpeg` | JPEG画像 |
|
|
208
|
+
| `gif` | GIF画像 |
|
|
209
|
+
| `svg` | SVGベクター画像 |
|
|
210
|
+
|
|
211
|
+
## 動作環境
|
|
212
|
+
|
|
213
|
+
- Python 3.8以上
|
|
214
|
+
- Windows / macOS / Linux
|
|
215
|
+
|
|
216
|
+
## ライセンス
|
|
217
|
+
|
|
218
|
+
MIT License
|
|
219
|
+
|
|
220
|
+
## 関連パッケージ
|
|
221
|
+
|
|
222
|
+
- [barcode-pao-wasm](https://pypi.org/project/barcode-pao-wasm/) - WebAssembly版(ポータブル)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
barcode_pao_native/SDL2.dll,sha256=WPCir2ZTRFtI5YrOaJD74je_dkUsl0PoADWNa5Nd7WQ,1598976
|
|
2
|
+
barcode_pao_native/SDL2_image.dll,sha256=SGEtL1qS2O7Z3zlpdCIs2caks54R8Cmi1GHNMzGLTsI,173568
|
|
3
|
+
barcode_pao_native/SDL2_ttf.dll,sha256=_Jn9cfxt-qSVaM1oxI_duQdf7kHuaq6x08ddqh1TdyE,1799680
|
|
4
|
+
barcode_pao_native/__init__.py,sha256=3UwYhq4E6pCR59avAtbibGk4eOuv0G5svPdPg45-XUs,1531
|
|
5
|
+
barcode_pao_native/_barcode_pao_native.cp311-win_amd64.pyd,sha256=uH3klK2TRuitsTwqpYf6M0nOkgq8xLsP3Ry_KgdkIfM,868864
|
|
6
|
+
barcode_pao_native-1.0.0.dist-info/METADATA,sha256=n6qCquBobMO0ebFM433gIb_jIeA_WbqlYL3tb0fOFzM,7565
|
|
7
|
+
barcode_pao_native-1.0.0.dist-info/WHEEL,sha256=bVDps4tOb0nHmbMU4uK7h9NZsZJmyTqcRbrvK3TZLY4,102
|
|
8
|
+
barcode_pao_native-1.0.0.dist-info/top_level.txt,sha256=yiuyM4yfhOYI_AxK7ACqir1QgTSEET7jH9vMgeGtAiA,19
|
|
9
|
+
barcode_pao_native-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
barcode_pao_native
|