Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
9102 Vistas

Hi everyone,

I'm having an issue with adding an image to a report. This is code of the report

<pageGraphics>

    <image x="37" y="37" height="50" width="110" file="../img/logo-coolabora.png" />

...

</pageGraphics>

And this is the error shown as I try to generate the PDF:

cannot identify image file
fileName=<open file u'C:\\Archivos de programa\\OpenERP 7.0-20140221-003045\\Server\\server\\openerp\\addons\\ajuste_did\\img\\logo-coolabora.png', mode 'r' at 0x03799E90> identity=[ImageReader@0x392ed50 filename=u'C:\\Archivos de programa\\OpenERP 7.0-20140221-003045\\Server\\server\\openerp\\addons\\ajuste_did\\img\\logo-coolabora.png']
handle_pageBegin args=()

(<type 'exceptions.IOError'>, IOError("cannot identify image file\nfileName=<open file u'C:\\\\Archivos de programa\\\\OpenERP 7.0-20140221-003045\\\\Server\\\\server\\\\openerp\\\\addons\\\\ajuste_did\\\\img\\\\logo-coolabora.png', mode 'r' at 0x03799E90> identity=[ImageReader@0x392ed50 filename=u'C:\\\\Archivos de programa\\\\OpenERP 7.0-20140221-003045\\\\Server\\\\server\\\\openerp\\\\addons\\\\ajuste_did\\\\img\\\\logo-coolabora.png']\n handle_pageBegin args=()",), <traceback object at 0x03933F30>)

I've read on the web that this is an issue due to some Python's library... Can someone help me?

Thanks in advance.

SOLUTION:

As @Jeudy said, I used an url like this:

<image x="37" height="37" height="50" width="110" file="http://localhost:8069/[module_name]/static/img/[image_name.image_format]" />

Avatar
Descartar
Autor

Thanks @Jeudy! it worked for me the solution in the "EDIT" part of the question.

Mejor respuesta

Hello,

I think you have to use absolute url for images or base64 econded one.

Use for example: http://your_odoo_server/your_module/static/img/your_image.png or directly encore your image in base64.

Related posts:

- https://www.odoo.com/fr_FR/forum/help-1/question/images-in-webkit-mako-pdf-reports-16735

Avatar
Descartar