Image optimization in Custom Print formats

We are a business based in India, registered under GST, and have to generate E-Invoice. I was able to get all the data I need and display most elements in a custom invoice format. The place where this keeps breaking is when I add the img tag as shown below

<img src="data:image/png;base64,{{ SignedQRCodeImg }}" class="qrcode">

On saving the template, erpnext gives the following error

and changes my email template to this

<img src="/files/AXwCN8t.png" class="qrcode">

What I also notice is that it, tries to create a file and attach it to this print format. As seen in the updates section and attachments section of the print format doc

1 Like

Ohhh God! Found the fix here

Replaced the entire image src and updated it like shown in the abovelink

{% set SignedQRCodeImgSRC = "data:image/png;base64," + get_qr_code(SignedQRCode,scale=2) %} <!-- Image can be placed here --> <img src={{SignedQRCodeImgSRC}} class="qrcode">