Package Exports
- qart-codes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qart-codes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
QArt-Codes
My own fancy, browser and server side QR Code generator.
This is built in pure JavaScript, so it should run anywhere. A bundle has also been provided for browser use.
Installation:
Simply run npm i qart-codes
Use guide:
NodeJS:
const qr = require('qart-codes');
qr.makeQR(
`{"lastName":"ever","firstName":"greatest","employeeID":1337,"online":true}`, // Data to encode - string or binary array.
"C:\\CompanyLogo.png", // The background image to use.
{
qrOpts: {
errorCorrectionLevel: 'H'
},
size: {
boxSize: 6
},
colors: {
dark: 'rgb(37,45,206)',
light: 'white'
}
}
).then(async (img) => {
console.log('Built image.');
await qr.encodeQR(img, 'out.png'); // Save the generated canvas bitmap to a file.
}).catch(console.error)Browser:
<script src="./bundle/browser.js"></script>
<script>
qartCode.makeQR(
`https://shadowmoo.se`,
"https://i.imgur.com/7tMdIX9.png",
{
qrOpts: {
errorCorrectionLevel: 'H'
},
size: {
boxSize: 6
},
colors: {
dark: 'rgb(37,45,206)',
light: 'white'
}
}
).then(async canv => {
const uri = await qartCode.encodeQR(canv, 'image/png', 0.95);
const img = new Image();
img.src = uri;
document.body.appendChild(img);
})
</script>