Skip to content

Commit 44ac329

Browse files
author
Contato FazMercado Softwares
committed
feat: implement advanced 2D barcode formats
- Add support for DataMatrix, PDF417, and Aztec barcode generation - Update README and examples to include new formats and usage instructions - Enhance library documentation to reflect the addition of new features - Update tests to cover new barcode types and ensure functionality This expands the library's capabilities, allowing for a wider range of barcode generation options.
1 parent 41c6a7c commit 44ac329

17 files changed

Lines changed: 1988 additions & 75 deletions

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ usvg = { version = "0.44", optional = true }
3434
# QR Code generation
3535
qrcode = "0.14"
3636

37+
# DataMatrix generation (implemented internally for now)
38+
# datamatrix = "0.3" # Will add proper library support later
39+
40+
# PDF417 generation (we'll implement basic version first)
41+
# pdf417 = "0.1" # Will add if available, otherwise custom implementation
42+
43+
# Aztec Code (we'll implement basic version first)
44+
# aztec = "0.1" # Will add if available, otherwise custom implementation
45+
3746
# SVG generation
3847
svg = "0.18"
3948

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,60 +31,92 @@
3131
### Python
3232

3333
```python
34-
from quickcodes import generate, read
34+
from quickcodes import generate_to_file
35+
import quickcodes as qc
3536

3637
# Gerar QR Code de pagamento Pix
37-
generate("QR", "00020126580014BR.GOV.BCB.PIX0114+5551999999995204000053039865405100.005802BR5920Padaria Exemplo6009SAO PAULO62070503***6304ABCD", output="pix.svg")
38+
generate_to_file("QRCode", "00020126580014BR.GOV.BCB.PIX0114+5551999999995204000053039865405100.005802BR5920Padaria Exemplo6009SAO PAULO62070503***6304ABCD", "pix.svg")
3839

39-
# Ler um código de barras de imagem
40-
data = read("produto.png")
41-
print(data) # -> "7891234567890"
40+
# Gerar DataMatrix para rastreamento farmacêutico (ANVISA)
41+
generate_to_file("DataMatrix", "010123456789012815240101", "pharma.svg")
42+
43+
# Gerar PDF417 para documentos oficiais
44+
generate_to_file("PDF417", "DRIVER LICENSE|DOE,JOHN|DOB:1990-01-01", "document.svg")
45+
46+
# Gerar Aztec para tickets de transporte
47+
generate_to_file("Aztec", "TKT:12345|FROM:NYC|TO:BOS|DATE:2024-01-15", "ticket.svg")
48+
49+
# Formatos disponíveis: QRCode, EAN13, UPCA, Code128, DataMatrix, PDF417, Aztec
4250
```
4351

44-
### JavaScript (Browser)
52+
### JavaScript (Browser) *[Planejado - WASM em desenvolvimento]*
4553

4654
```javascript
47-
import { generate, read } from "quickcodes-wasm";
55+
import { generate } from "quickcodes-wasm";
4856

4957
// Gerar um EAN-13
5058
let svg = generate("EAN13", "7891234567890");
5159

52-
// Ler QR Code da webcam
53-
let result = await read(videoStream);
54-
console.log(result);
60+
// Gerar DataMatrix para farmácia
61+
let datamatrix = generate("DataMatrix", "010123456789012815240101");
62+
63+
// Gerar PDF417 para documentos
64+
let pdf417 = generate("PDF417", "DRIVER LICENSE|DOE,JOHN|1990-01-01");
65+
66+
// Gerar Aztec para tickets
67+
let aztec = generate("Aztec", "TKT:12345|FROM:NYC|TO:BOS");
5568
```
5669

5770
### 📸 Exemplos Gerados
5871

59-
Após executar `cargo run --example basic_usage`, você encontrará estes arquivos em `examples/output/`:
72+
Após executar os exemplos, você encontrará estes arquivos em `examples/output/`:
6073

74+
**Fase 1 (Básicos):**
6175
- **qr_hello.svg** - QR Code: "Hello, QuickCodes!"
6276
- **ean13_example.png** - EAN-13: 1234567890128
6377
- **upc_a_example.svg** - UPC-A: 036000291452
6478
- **code128_example.svg** - Code128: "HELLO123"
6579
- **pix_payment.svg** - QR Code para pagamento Pix
6680
- **github_url.png** - QR Code com URL do GitHub
6781

82+
**Fase 2 (Avançados):**
83+
- **datamatrix_pharma.svg** - DataMatrix farmacêutico (ANVISA)
84+
- **datamatrix_industrial.png** - DataMatrix industrial
85+
- **pdf417_document.svg** - PDF417 para documentos
86+
- **pdf417_invoice.png** - PDF417 com dados grandes
87+
- **aztec_transport.svg** - Aztec para transporte
88+
- **aztec_event.png** - Aztec para eventos
89+
- **datamatrix_unicode.svg** - DataMatrix com Unicode
90+
6891
---
6992

7093
## 🎯 Status Atual
7194

72-
**MVP Funcional Completo!**
95+
**Fase 2 - Códigos 2D Avançados Implementados!**
7396

74-
-4 formatos de código implementados (QR, EAN-13, UPC-A, Code128)
97+
-7 formatos de código implementados (QR, EAN-13, UPC-A, Code128, DataMatrix, PDF417, Aztec)
7598
- ✅ 2 formatos de exportação (SVG, PNG)
76-
-40 testes passando (25 unitários + 12 integração + 3 doctests)
77-
- ✅ API unificada Rust e Python
78-
- ✅ Bindings Python com PyO3
99+
-56 testes passando (41 unitários + 12 integração + 3 doctests)
100+
- ✅ API unificada Rust e Python para todos os formatos
101+
- ✅ Bindings Python com PyO3 atualizados
79102
- ✅ Código 100% limpo (0 warnings, clippy aprovado)
80-
- ✅ Exemplos funcionais e documentação completa
103+
- ✅ Exemplos funcionais da Fase 2 e documentação completa
104+
- ✅ Suporte completo para casos de uso farmacêuticos (DataMatrix/ANVISA)
105+
- ✅ Suporte para documentos oficiais (PDF417)
106+
- ✅ Suporte para tickets de transporte (Aztec)
81107

82108
```bash
83109
# Teste a biblioteca agora:
84110
git clone https://github.com/marcioreck/quickcodes
85111
cd quickcodes
112+
113+
# Exemplos da Fase 1 (formatos básicos)
86114
cargo run --example basic_usage
87-
# Veja os códigos gerados em examples/output/
115+
116+
# Exemplos da Fase 2 (códigos 2D avançados)
117+
cargo run --example phase2_usage
118+
119+
# Veja todos os códigos gerados em examples/output/
88120
```
89121

90122
---
@@ -108,13 +140,13 @@ cargo run --example basic_usage
108140
* [x] Configurações de tamanho e DPI
109141
* [x] **Bindings Iniciais**
110142
* [x] Python (PyO3) - Implementado e testado
111-
* [ ] JavaScript/Node.js (NAPI-RS)
143+
* [ ] JavaScript/Node.js (NAPI-RS) [postergado para realizar após API estar completa, toda a fase 2]
112144

113-
### 🔧 **Fase 2 - Expansão Industrial**
114-
* [ ] **Códigos 2D Avançados**
115-
* [ ] DataMatrix (farmacêutica/ANVISA)
116-
* [ ] PDF417 (documentos oficiais)
117-
* [ ] Aztec Code (transporte)
145+
### 🔧 **Fase 2 - Expansão Industrial** ⚡ EM PROGRESSO
146+
* [x] **Códigos 2D Avançados** ✅ CONCLUÍDO
147+
* [x] DataMatrix (farmacêutica/ANVISA)
148+
* [x] PDF417 (documentos oficiais)
149+
* [x] Aztec Code (transporte)
118150
* [ ] **Leitura/Decodificação**
119151
* [ ] Leitor de imagens estáticas
120152
* [ ] Algoritmos de detecção e correção

examples/README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/output/aztec_event.png

2.03 KB
Loading

0 commit comments

Comments
 (0)