Image field not showing in custom print format

Hi all,

I’ve been trying to display an image in my custom print format (jinja) by simply inserting the below snippet within the body tags of the code:

<img src={{ doc.image }}>

It however doesn’t seem to be working as the image doesn’t appear. I have a custom Image field called ‘image’ which has an Attach Image field in the Options. It works fine on the form and in the standard print format but doesn’t show up in the custom format!

Any pointers will be much appreciated

Thanks

Hello @wale,

Try using this code - <img src="{{doc.image_fieldname}}">

Replace image_fieldname with the fieldname of your custom field.

Hope this helps.

regards,
Sujay

Hi @Sujay

Thanks a lot for your response. I already tried that and several other variations but none of them worked. I finally figured out something that did though:

<div class="image"><img src="{{ doc.attach_image }}" /></div>

Just in case someone else is looking for a similar solution :blush:

Do note that the reference should be to the ‘Attach Image’ field and NOT the actual ‘Image’ field

Cheers!

1 Like