Export SVG-metadata when exporting to PDF (preserve as much information as possible)
Migrated from: https://bugs.launchpad.net/inkscape/+bug/169886
Export SVG-metadata when exporting to PDF
A patch was available for the old Inkscape PDF export (before cairo). I did not upload the patch or any of the comments here, since they are probably obsolete (for historical purposes, follow the link above ;-).
Back then, cairo did not support writing metadata to PDF files, but now it does, so this one should be relatively easy to fix.
Steps to reproduce:
Insert metadata (title, author, etc.) in any SVG file.
Open the file in Inkscape and save it as PDF file (options in the Save As... dialog are irrelevant here).
What happened?
The resulting PDF file does not contain any of the human-readable metadata.
What should have happened?
It should contain as much metadata as possible. When using Cairo to produce the PDF file, that would at least include:
CAIRO_PDF_METADATA_TITLE The document title (Since 1.16)
CAIRO_PDF_METADATA_AUTHOR The document author (Since 1.16)
CAIRO_PDF_METADATA_SUBJECT The document subject (Since 1.16)
CAIRO_PDF_METADATA_KEYWORDS The document keywords (Since 1.16)
CAIRO_PDF_METADATA_CREATOR The document creator (Since 1.16)
CAIRO_PDF_METADATA_CREATE_DATE The document creation date (Since 1.16)
CAIRO_PDF_METADATA_MOD_DATE The document modification date (Since 1.16)
(source: https://cairographics.org/manual/cairo-PDF-Surfaces.html#cairo-pdf-metadata-t)
Notes:
- The "document created" field is automatically filled by cairo with the date and time of the cairo run. In my opinion this should rather go into the "document modified" date. The "document created" field should be filled with the metadata information ("Date" in the Inkscape Document properties).
- There is no "subject" in the Inkscape
Document properties...dialog (tabMetadata). One could a) use any of the other fields (e.g.CoverageoderDescription) as the PDF subject, or b) add a subject field to theDocument properties...dialog (even though this may not conform to the SVG specification or Dublin Core), or c) leave the subject blank. I have no strong opinion on this one. - The "producer" field is automatically filled by cairo with "cairo 1.16.0 (https://cairographics.org)". Not sure if it is possible or desirable to change this to "Inkscape vXXX.YYY". (edit: this is okay. Inkscape should go into the "creator" field, and actually does in Inkscape 1.x)
Inkscape Version and Operating System:
- Inkscape Version: Inkscape 0.92.4 (5da689c313, 2019-01-14)
- Operating System: Debian GNU/Linux (but any OS is affected)
- Operating System version: 10
(edit: this is mostly (partly?) fixed in Inkscape 1.0.x, see comments below)
Minimal example (check out the metadata, not the visible content):
metadata.svg
metadata-written-by-inkscape-0.92.pdf
metadata-written-by-inkscape-1.0rc1.pdf