diff --git a/report_qweb_pdf_watermark/README.rst b/report_qweb_pdf_watermark/README.rst index 35c63a05..d0a7caaf 100644 --- a/report_qweb_pdf_watermark/README.rst +++ b/report_qweb_pdf_watermark/README.rst @@ -10,6 +10,11 @@ This module was written to add watermarks (backgrounds) to PDF reports. This is necessary because of the way wkhtmltopdf handles headers and footers, in the current versions if quite impossible to have a background for the complete page. +Installation +============ + +This module works out of the box, but is faster if you install the python library PyPDF2. + Usage ===== diff --git a/report_qweb_pdf_watermark/__openerp__.py b/report_qweb_pdf_watermark/__openerp__.py index 74ccecf9..9a63b1ba 100644 --- a/report_qweb_pdf_watermark/__openerp__.py +++ b/report_qweb_pdf_watermark/__openerp__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Pdf watermark", - "version": "9.0.1.0.0", + "version": "9.0.1.0.1", "author": "Therp BV,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Reporting", diff --git a/report_qweb_pdf_watermark/models/report.py b/report_qweb_pdf_watermark/models/report.py index acb9aff6..3e033157 100644 --- a/report_qweb_pdf_watermark/models/report.py +++ b/report_qweb_pdf_watermark/models/report.py @@ -3,10 +3,20 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from base64 import b64decode from logging import getLogger -from pyPdf import PdfFileWriter, PdfFileReader -from pyPdf.utils import PdfReadError from PIL import Image from StringIO import StringIO +from pyPdf import PdfFileWriter, PdfFileReader +from pyPdf.utils import PdfReadError +try: + from PyPDF2 import PdfFileWriter, PdfFileReader # pylint: disable=W0404 + from PyPDF2.utils import PdfReadError # pylint: disable=W0404 +except ImportError: + pass +try: + # we need this to be sure PIL has loaded PDF support + from PIL import PdfImagePlugin # noqa: F401 +except ImportError: + pass from openerp import api, models, tools logger = getLogger(__name__)