How to insert barcode in docx using helper?
-
Re: How can I merge docx with barcode?
I have a docx template and would like to insert barcode inside it (qrCode)
Her is what I tried, but not working. Please, can someone telle how to achieve this.
Screentip :{{docxImage src=barcodeHerper "qrcode" data.invoiceNumber}}
helper function :
const bwipjs = require('bwip-js') function barcodeHelper(barcodeType, text) { return bwipjs.toBuffer({ bcid: barcodeType, text: text }).then(p => 'data:image/png;base64,' + p.toString('base64')) }
-
See an example here
https://playground.jsreport.net/w/anon/x1IyJsyMIn handlebars, when you want to use a helper to calculate the attribute of another helper, you use
()
subexpressions.
https://handlebarsjs.com/guide/expressions.html#subexpressions{{docxImage src=(barcodeHerper "qrcode" data.invoiceNumber)}}