Menu

ช่วยเหลือ

0

how to display binary file(PDF) on webpage using template ?

Avatar
Imran Ali

Hi every one,

I want to show my attachment(binary) field data on webpage as pdf file kindly guid.

Thank you so much in advance

Avatar
Discard
1 Answer
1
Avatar
Sylvain Michel RATSARAFAHATRA
Best Answer

Hi,

You can use the following code, adapt it as you need:

<a t-attf-href="/web/content/#{attachment.id}?download=true" target="_blank">
    <div class='oe_attachment_embedded o_image' t-att-title="attachment.name" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/100x80"/>
    <div class='oe_attachment_name'><t t-raw='attachment.name' /></div>
</a>

Best regards!

Avatar
Discard