Added barcode generatin

ref #19
This commit is contained in:
2021-02-09 19:15:08 +01:00
parent b77945a9e4
commit 5c075bce8b
3 changed files with 14 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import bwipjs from "bwip-js";
export const asyncHelpers = new AsyncHelpers();
async function generateBarcode(str, options, emtpy, cb) {
if (str == null) { cb(null, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="); return; }
let res = await generateBase64Barcode(options.toString(), str.toString());
cb(null, res);
}
@@ -18,7 +19,7 @@ export async function generateBase64Barcode(type: string, content: string): Prom
height: 10,
width: 10,
includetext: true,
textxalign: 'center',
textxalign: 'center'
}
if (type != "qrcode") {
delete options.width;