Generating a QR Code with barcode_svg using twig
I am trying to generate a QR Code containing the part name for a label. I got it so far that I generated a svg string and data uri encoded it. The part that I am missing is to generate the QR Code picture to show up in the label. Can someone help me with that? Best Regards
Thats the barcode encoded as data uri.
To output it as actual picture in the pdf you need to create an element, and use this data uri string as content for the
src attribute.
Something like <img src="{{barcode_svg("Whatever")}}>
@AutoGuy404 did you get this to work?
I tested it and got a positive result when putting this into the content section (as HTML; click on "Source" first):
<img src="{{barcode_svg(placeholder('[[NAME]]', element), 'QRCODE')|data_uri}}" height="80px">
The barcode type is now also in single quotes, so you don't have to escape it.
I tested it and got a positive result when putting this into the content section (as HTML; click on "Source" first):
<img src="{{barcode_svg(placeholder('[[NAME]]', element), 'QRCODE')|data_uri}}" height="80px">The barcode type is now also in single quotes, so you don't have to escape it.
Could you maybe please share your whole profile / HTML code? I‘m trying to achieve the same - but unfortunately I can’t get it to work.
Edit: for everyone reading this: my user was missing the twig permission -> the profile did not have twig enabled