Skip to content

Commit

Permalink
Merge 78e0161 into 8cc6325
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Bachmann committed Jul 19, 2016
2 parents 8cc6325 + 78e0161 commit 89b05e4
Show file tree
Hide file tree
Showing 11 changed files with 814 additions and 0 deletions.
115 changes: 115 additions & 0 deletions pdf_compression/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=======================
PDF Compression & PDF/A
=======================

This addon provides the ability to convert outgoing and imported PDF attachments.
You can compress the PDFs to save space in you database or file system.
Also the possibility exists to convert PDFs in PDF/A. Currently implemented:

* PDF/A-1b
* PDF/A-2b (recommend to use this setting because it is faster and result in smaller files)


Installation
============

#. You need at least Gostscript 9.18 (I recommend 9.19)
`http://ghostscript.com <http://ghostscript.com/download/gsdnld.html>`_


Configuration
=============

If the odoo module is installed:

#. You can define ``Compession level`` and ``PDF/A TYPE`` via
`Settings -> Configuration -> Knowledge`.
#. Also you can override PDF/A option for individual Reports apart from Global Settings via
`Settings -> Technical -> Reports -> Reports -> Select a Report -> PDF/A archiving`.



Usage
=====


#. Compression rate outcome:

I uploaded a 1MB PDF file with a mix of pictures tables and text.

Settings:

* screen: selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
* ebook: selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
* printer: selects output similar to the Acrobat Distiller "Print Optimized" setting.
* prepress: selects output similar to Acrobat Distiller "Prepress Optimized" setting.
* default: selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.

Examples:

* screen: 1MB -> 200KB some quality loss notice (jpg artefacts in pictures)
* ebook: 1MB -> 540KB little quality loss notice (some jpg artefacts in pictures but way better then screen)
* printer: 1MB -> 740KB no quality loss notice
* prepress: 1MB -> 820KB no quality loss notice
* default: 1MB -> 680KB little quality loss notice (some jpg artefacts in pictures but way better then screen)

#. PDF/A conversion:

`Info wiki page <https://en.wikipedia.org/wiki/PDF/A>`_

PDFs will be converted to:

* PDF/A-1b
* PDF/A-2b



Known issues / Roadmap
======================

* Had to override the _run_wkhtmltopdf Function to pass context through it
* Implementing other PDF/A options
* Future Goal to integrate ZUGFeRD
* only PDFs which are saved as attachments are converted
* (if you use the print button to generate pdf the "first" time the compession/pdfa is not used but the saved attachment is converted)


Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Benjamin Bachmann <https://github.com/Benniphx>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
3 changes: 3 additions & 0 deletions pdf_compression/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
24 changes: 24 additions & 0 deletions pdf_compression/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "PDF Compression",
'summary': """compresses the pdf files for ir.attachement""",
'author':
"Benjamin Bachmann ,"
"bloopark systems GmbH & Co. KG ,"
"Odoo Community Association (OCA)",
'website': "http://www.bloopark.de",
'category': 'attachement',
'version': '8.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'report',
'knowledge',
],
'data': [
'views/backend.xml',
'data/ir_values.xml',
],
'installable': True,
'auto_install': False,
}
20 changes: 20 additions & 0 deletions pdf_compression/data/ir_values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">

<!--compression-->
<function model="ir.values" name="set_default">
<value>ir.attachment</value>
<value>compression</value>
<value>no</value>
</function>

<!--pdfa_option-->
<function model="ir.values" name="set_default">
<value>ir.attachment</value>
<value>pdfa_option</value>
<value>no</value>
</function>

</data>
</openerp>
136 changes: 136 additions & 0 deletions pdf_compression/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pdf_compression
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0alpha1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-03 13:01+0000\n"
"PO-Revision-Date: 2015-12-03 13:01+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: pdf_compression
#: model:ir.actions.act_window,name:pdf_compression.action_attachment_set_configuration
#: model:ir.ui.menu,name:pdf_compression.menu_attachment_set_configuration
msgid "Attachment"
msgstr "Dateianhänge"

#. module: pdf_compression
#: view:knowledge.config.settings:pdf_compression.view_knowledge_configuration_pdfa
msgid "Attachment Settings"
msgstr "Dateianhänge Einstellungen"

#. module: pdf_compression
#: field:knowledge.config.settings,compression:0
msgid "PDF Compression"
msgstr "PDF Kompression"

#. module: pdf_compression
#: field:knowledge.config.settings,pdfa_option:0
msgid "Converts the PDF in a PDF/A"
msgstr "Konvertiert PDF in PDF/A"

#. module: pdf_compression
#: help:knowledge.config.settings,pdfa_option:0
#: help:ir.actions.report.xml,pdf_option:0
msgid "PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for the digital preservation of lectronic documents."
msgstr "PDF/A ist ein Format zur Langzeitarchivierung digitaler Dokumente, das von der International Organization for Standardization (ISO) als Subset des Portable Document Format (PDF) genormt wurde."

#. module: pdf_compression
#: view:knowledge.config.settings:pdf_compression.view_knowledge_configuration_pdfa
msgid "Configure Attachment"
msgstr "Konfiguriere Dateianhänge"

#. module: pdf_compression
#: field:knowledge.config.settings,create_uid:0
msgid "Created by"
msgstr "Created by"

#. module: pdf_compression
#: field:knowledge.config.settings,create_date:0
msgid "Created on"
msgstr "Created on"

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "DEFAULT selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file."
msgstr "DEFAULT Standared Einsteluung, möglicherweise auf Kosten einer größeren Dateigröße."

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "EBOOK selects medium-resolution output similar to the Acrobat Distiller \"eBook\" setting."
msgstr "EBOOK mittlere Auflösung, Ausgabe ähnlich der Acrobat Distiller \"eBook\" -Einstellung."

#. module: pdf_compression
#: field:knowledge.config.settings,id:0
msgid "ID"
msgstr "ID"

#. module: pdf_compression
#: field:knowledge.config.settings,write_uid:0
msgid "Last Updated by"
msgstr "Last Updated by"

#. module: pdf_compression
#: field:knowledge.config.settings,write_date:0
msgid "Last Updated on"
msgstr "Last Updated on"

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "No Compression"
msgstr "Keine Komprimierung"

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "PREPRESS selects output similar to Acrobat Distiller \"Prepress Optimized\" setting."
msgstr "PREPRESS Ausgabe ähnlich der Acrobat Distiller \"Prepress Optimized\" -Einstellung."

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "PRINTER selects output similar to the AcrobatDistiller \"Print Optimized\" setting."
msgstr "PRINTER Ausgabe ähnlich der Acrobat Distiller \"Print Optimized \" -Einstellung."

#. module: pdf_compression
#: selection:knowledge.config.settings,compression:0
msgid "SCREEN selects low-resolution output similar to the Acrobat Distiller \"Screen Optimized\" setting"
msgstr "SCREEN niedrigere Auflösung, Ausgabe ähnlich der Acrobat Distiller \"Screen Optimized\" -Einstellung"

#. module: pdf_compression
#: help:knowledge.config.settings,compression:0
msgid "The Compression Level."
msgstr "Die Komprimierungsstufe."

#. module: pdf_compression
#: selection:ir.actions.report.xml,pdf_option:0
#: selection:knowledge.config.settings,pdfa_option:0
msgid "None"
msgstr "Keine Archivierung"

#. module: pdf_compression
#: field:ir.actions.report.xml,pdf_option:0
msgid "PDF/A archiving"
msgstr "PDF/A Archivierung"

#. module: pdf_compression
#: selection:ir.actions.report.xml,pdf_option:0
#: selection:knowledge.config.settings,pdfa_option:0
msgid "PDF/A-1b"
msgstr "PDF/A-1b"

#. module: pdf_compression
#: selection:ir.actions.report.xml,pdf_option:0
#: selection:knowledge.config.settings,pdfa_option:0
msgid "PDF/A-2b"
msgstr "PDF/A-2b"

#. module: pdf_compression
#: selection:ir.actions.report.xml,pdf_option:0
msgid "Default PDF/A handling"
msgstr "Standard PDF/A Handhabung"
6 changes: 6 additions & 0 deletions pdf_compression/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).#
from . import ir_actions
from . import ir_attachment
from . import report
from . import res_config
21 changes: 21 additions & 0 deletions pdf_compression/models/ir_actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields
from openerp.models import Model


class IrActionsReportXml(Model):
_inherit = 'ir.actions.report.xml'

pdf_option = fields.Selection(
string='PDF/A archiving',
selection=[
('no', 'None'),
('default', 'Default PDF/A handling'),
('pdfa1b', 'PDF/A-1b'),
('pdfa2b', 'PDF/A-2b')
],
help="PDF/A is an ISO-standardized version of the Portable Document "
"Format (PDF) specialized for the digital preservation of "
"electronic documents.",
default='default')
Loading

0 comments on commit 89b05e4

Please sign in to comment.