Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to generate PDF using binary(Base64) data in odoo using web module?

Mohit Kotak (MK)
on 1/3/15, 2:06 PM 3,273 views

Hello All,

I put one to many field in product & pdf field as binary.

I got binary data on webpage. I want to convert into pdf file all data.

I also used jquery for that.




Mohit Kotak (MK)
On 1/22/15, 6:42 AM

Hello All,

I got solution.

pdf file dispaly on website page and also download it.

Here, I paste the code.

I hope it is useful to you also.

<!-- Display list of pdfs to download. -->

<div t-if="product.pdfs" class="row">
                            <b>Product Documents:</b>
                        <table width="100%" class="table table-responsive">
                            <t t-foreach="product.pdfs" t-as="i">
                                <tr t-if="i.pdf">
                                        <t t-esc="i.name" />
                                        <span align="center">
                                            <a t-att-href="'data:application/pdf;base64,%s' %i.pdf"
                                                <img style="height:25px;width:100px;"
                                                    src="/website_pdf_download/static/src/img/PDF-Download-Button.png" />

I hope this is useful to all of you.



| 5 3 6
Jakarta, Indonesia
On 1/7/15, 6:46 AM

@Mohit, why don't you try to use ir.attachment instead?  Create one2many field from product to ir.attachment and then let ir.attachment handles the display using many2many_binary widget.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 1/3/15, 2:06 PM
Seen: 3273 times
Last updated: 12/13/15, 1:11 PM