Release 1.12: use flateEncode() for attachments and XMP metadata

This commit is contained in:
Alexis de Lattre 2020-07-16 23:22:41 +02:00 committed by Nicolas ROCHE
parent 6ac0bd47a4
commit fd6be6a89f
3 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Factur-X Python library
=======================
Factur-X is the e-invoicing standard for France and Germany. The Factur-X specifications are available on the `FNFE-MPE website <http://fnfe-mpe.org/factur-x/>`_ in English and French. The Factur-X standard is also called ZUGFeRD 2.0 in Germany.
Factur-X is the e-invoicing standard for France and Germany. The Factur-X specifications are available on the `FNFE-MPE website <http://fnfe-mpe.org/factur-x/>`_ in English and French. The Factur-X standard is also called `ZUGFeRD 2.1 in Germany <https://www.ferd-net.de/standards/zugferd-2.1.1/index.html>`_.
The main feature of this Python library is to generate Factur-X invoices from a regular PDF invoice and a Factur-X compliant XML file.
@ -86,6 +86,10 @@ Contributors
Changelog
=========
* Version 1.12 dated 2020-07-16
* Compress attachments and XMP metadata using Flate compression
* Version 1.11 dated 2020-05-11
* Fix crash UnicodeEncodeError on Python 2.7

View File

@ -1 +1 @@
__version__ = '1.11'
__version__ = '1.12'

View File

@ -453,6 +453,7 @@ def _filespec_additional_attachments(
params_dict[NameObject('/CreationDate')] = createStringObject(creation_date_pdf)
file_entry = DecodedStreamObject()
file_entry.setData(file_dict['filedata'])
file_entry = file_entry.flateEncode()
file_mimetype = mimetypes.guess_type(filename)[0]
if not file_mimetype:
file_mimetype = 'application/octet-stream'
@ -495,6 +496,7 @@ def _facturx_update_metadata_add_attachment(
})
file_entry = DecodedStreamObject()
file_entry.setData(facturx_xml_str) # here we integrate the file itself
file_entry = file_entry.flateEncode()
file_entry.update({
NameObject("/Type"): NameObject("/EmbeddedFile"),
NameObject("/Params"): params_dict,
@ -555,6 +557,7 @@ def _facturx_update_metadata_add_attachment(
metadata_xml_str = _prepare_pdf_metadata_xml(facturx_level, pdf_metadata)
metadata_file_entry = DecodedStreamObject()
metadata_file_entry.setData(metadata_xml_str)
metadata_file_entry = metadata_file_entry.flateEncode()
metadata_file_entry.update({
NameObject('/Subtype'): NameObject('/XML'),
NameObject('/Type'): NameObject('/Metadata'),