Flayms/Markdown2Pdf

Set title in file properties of PDF file

Closed this issue · 4 comments

Is there a way to set the title property in the file properties in the generated PDF file.
As far as I can see the filename of the html file is taken as title property.
image

It uses the html title-element which is currently unset so it defaults to the filename.
I think the best way to resolve this is to insert a title-element with Markdown2PdfOptions.Title into the html (same property that also gets inserted into header / footer) if set. What do you think about this?

Sounds good.
Once working on the file properties may be it is worth to add other file properties as well. e.g. Author, Subject and Keywords
Here an idea https://stackoverflow.com/questions/51153026/puppeteer-pdf-title-and-author-metadata

Default settings could be:
Title: filename
Author: empty
Subject: empty
Keywords: empty

Alright, gonna set the title over the HTML.
For the other metadata there's no puppeteer support but might be adjustable with https://github.com/UglyToad/PdfPig which I am already using for generating the TOC page numbers.

With PdfPig it's easy to read the Metadata, however It seems like It can't be used it for editing it. Currently still looking for an easy way to edit XMP metadata in C#. Exiftool is nice but would need to create a wrapper for it that also works cross-platform. This sounds quite painful.