Generate QRCode using Aztec format
- IOS
Native implementation using Core Image Filter
CIAztecCodeGenerator
)
- Browser
Implementation based on bwip-js
cordova plugin add https://github.com/bsorrentino/cordova-plugin-aztec-qrcode.git --save
In HTML template create a div as QRCode container
<div id="qrCode">
<!-- this will contain the Image -->
</div>
In javascript call the provided API gives a reference to container
PKBarcodeFormatAztec.generate(
document.getElementById('qrCode'),
"message to encode",
function(e) => {
console.log( "QRCODE showed on", element);
},
function(err) {
console.log("ERROR ", err);
});
In HTML template create a div as QRCode container
<div id="qrCode" #qrCode class="code">
<!-- this will contain the Image -->
</div>
In javascript call the provided API gives a reference to container
@ViewChild('qrCode') qrCode: ElementRef; //HTMLDivElement;
generate() {
PKBarcodeFormatAztec.generate(
this.qrCode.nativeElement,
"message to encode",
(element) => {
console.log( "QRCODE showed on", element);
},
(err) => {
console.log("ERROR ", err);
});
}
Dependencies
Since the plugin has been written in swift we need to install also the cordova-plugin-add-swift-support. It provides a way to configure IOS toolchains to support swift 3.0