-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQRCode-generator.js
More file actions
41 lines (33 loc) · 1.12 KB
/
Copy pathQRCode-generator.js
File metadata and controls
41 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import QRCode from "qrcode";
// Données d'entrée - votre exemple
const qrData = "GM2:V001234567:ABC:1791792657:E8F87B";
const configMedium = {
errorCorrectionLevel: 'M', // Medium error correction ~15%
type: 'png',
quality: 0.92, // Qualité de l'image PNG par défaut
margin: 1,
color: {
dark: '#000000', // Modules noirs
light: '#FFFFFF' // Arrière-plan blanc
},
width: 300
};
async function generateQRMediumOnly() {
try {
console.log("🚀 Génération du QR Code (Medium)");
console.log(`📝 Données : ${qrData}`);
// Génération et sauvegarde du QR code Medium
await QRCode.toFile('qr-basic-fit-medium.png', qrData, configMedium);
console.log("✅ Fichier QR Code Medium généré : qr-basic-fit-medium.png");
// Aperçu terminal rapide
const terminalOutput = await QRCode.toString(qrData, {
type: 'terminal',
errorCorrectionLevel: 'M'
});
console.log("\n📱 Aperçu Terminal :\n");
console.log(terminalOutput);
} catch (error) {
console.error("❌ Erreur lors de la génération du QR code Medium :", error);
}
}
generateQRMediumOnly();