-
-
Notifications
You must be signed in to change notification settings - Fork 866
[FIX] Fix Watermark from PNG #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this import used?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment added on the code.
Codecov will fail because previous commits were failing.
JordiBForgeFlow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on runbot. Allows to print from a watermark using a PNG image
pedrobaeza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.