[FIX] Fix Watermark from PNG - #144
Conversation
| "name": "Pdf watermark", | ||
| "version": "10.0.1.0.0", | ||
| "author": "Therp BV,Odoo Community Association (OCA)", | ||
| "version": "10.0.2.0.0", |
There was a problem hiding this comment.
This is a fix, not a new refactoring, so please change only last number. Check https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#version-numbers
| except PdfReadError: | ||
| # let's see if we can convert this with pillow | ||
| try: | ||
| from PIL import PdfImagePlugin |
75b8e2a to
ec30d60
Compare
|
If PdfImagePlugin is not initialized, we cannot transform a PNG image to PDF. The problem is related to Pillow creation: https://github.com/python-pillow/Pillow/blob/master/PIL/PdfImagePlugin.py |
|
Please add this explanation as comment before the import line so that others that see the code don't wonder the same. |
|
@alexis-via We need your help to test the generation of reports in PDF. Currently we are getting stuck when the wkhtmltopdf process is run, and a subprocess is open: However it seems that you managed to get past this issue here!: |
0c22939 to
6daceca
Compare
| install: | ||
| - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools | ||
| - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} | ||
| - export WKHTMLTOPDF_VERSION=0.12.4 |
There was a problem hiding this comment.
It is currently working on travis. The problem was related to wkhtmltopdf version. It must be 0.12.4, so I download it using travis_install_nightly.
Default Wkhtmltopdf version is not working because it does not add headers on the exported reports.
| from StringIO import StringIO | ||
| from odoo import api, models, tools | ||
| from PIL import PdfImagePlugin # flake8: noqa | ||
|
|
There was a problem hiding this comment.
Comment added on the code.
Codecov will fail because previous commits were failing.
JordiBForgeFlow
left a comment
There was a problem hiding this comment.
Tested on runbot. Allows to print from a watermark using a PNG image
pedrobaeza
left a comment
There was a problem hiding this comment.
This will mean a problem with my other PR (https://github.com/OCA/reporting-engine/pull/145/files#diff-354f30a63fb0907d4ad57269548329e3R9), but when the first will be merged, then we solve the conflicts
|
Fast-tracking this for leading with the other PR |
When we are trying to create a Watermark from a PNG, we need to import PdfImagePlugin.