vietqr-gen
v1.0.1
Published
QR code generator with VietQR logo support
Downloads
4
Readme
VietQR Generator
A command-line tool for generating VietQR codes and embedding them into SVG templates.
Installation
Install globally using npm:
npm install -g vietqr-genUsage
Once installed globally, you can run the tool using:
vietqr-gen -c <csv-file> [-t <template-file>] -o <output-directory>Parameters
-c, --csv: CSV file with bank account and VietQR data-t, --template: SVG template file (defaults to template.svg in package directory)-o, --output: Output directory for generated files-l, --logo: Optional logo path:- Default: Built-in VietQR logo
- Use
-l noneto generate QR codes without logo - Use
-l path/to/logo.svgfor custom logo
CSV Format
Required CSV columns:
ID: Identifier (optional)STK: Bank account reference codeGenQR: VietQR data string
Example CSV:
ID,STK,GenQR
BIDV1,V3CASLRPR13MT76,00020101021138590010A000000727012900069704180115V3CASLRPR13MT760208QRIBFTTA53037045802VN6304ABD7
BIDV2,V3CASLHRE4GFPY5,00020101021138590010A000000727012900069704180115V3CASLHRE4GFPY50208QRIBFTTA53037045802VN6304B5EATemplate Format
Your SVG template must contain:
<g id="qrcode">
<rect width="1299" height="1299" x="642.5" y="1091.5" />
</g>Exporting from Figma
To create a compatible template from Figma:
- Create a frame with your desired design
- Add a rectangle where you want the QR code to appear
- Group the rectangle and name the group "qrcode"
- Export as SVG

Quick Start
- Save your VietQR data in a CSV file (e.g.,
data.csv) - Run with default template:
vietqr-gen -c data.csv -o output- Or use your own template:
vietqr-gen -c data.csv -t custom-template.svg -o output- Run with desired logo option:
# Use default template
vietqr-gen -c data.csv -o output
# Specify custom template
vietqr-gen -c data.csv -t custom-template.svg -o output
# No logo
vietqr-gen -c data.csv -o output -l none
# Custom logo
vietqr-gen -c data.csv -o output -l custom-logo.svgGenerated files will be named using the STK values (e.g., V3CASLRPR13MT76.svg).
Dependencies
- qr-code-styling: QR code generation
- csv-parse: CSV file processing
- commander: Command-line interface
- fs-extra: File system operations
License
MIT License - Copyright (c) 2024 TuanPM
See LICENSE for details.
