kraft
kraft copied to clipboard
Feature Request: Add a post-processing step using exiftool to add metadata to "printed" files
Several attempts to add metadata to the generated using the initial Grantlee templates failed as the process depends on the exact versions of libcairo and weasyprint and will not permit setting arbitrary tags or reliable set the permitted tags.
The obvious alternative is using an external tool like exiftool as last processing step. On order to permit maximum flexibility there should be a user-provided file (e. g. PDF-tags.gtmpl -- a configurable name would be a good idea, too) that will contain lines consisting of "tag name", "value" pairs which will be either fed to exiftool -tagsFromFile
or as individual command line parameters to form a command like exiftool -"tag name"="value"
.
That way a file like
Producer, "Kraft Version 0.98"
Creator, "{{ me.organisation }}"
Author, "{{ me.NAME }}"
DocumentType, "{{` doc.docType }}"
Correspondent, "{{ customer.organisation }}"
{% if doc.projectLabel %} CorrespondentReference, "{{ doc.buyerReference }}"{% endif %}
ValidityDate, "{{ doc.dateStrISO }}"
DocumentID", "{{ doc.ident }} {{ doc.docIDStr }} {{ doc.identifier }}"
{% if doc.predecessor %}Predecessor, "{{ doc.predecessor }}"{% endif %}
{% if doc.projectLabel %}Project, "{{ doc.projectLabel }}"{% endif %}
could be used to generate the required literal values for exiftool
.