When saving to PDF, automatically set the title metadata attribute from the webpage's title
Categories
(Core :: Printing: Output, enhancement)
Tracking
()
People
(Reporter: nekohayo, Unassigned)
References
Details
Basically as the title says.
Steps to reproduce
With Firefox 133 from Fedora 41's repositories:
- From any webpage (particularly a news article, for example), hit
Ctrl+P. - Choose "Save to PDF" as the output, instead of a physical printer.
- Save the file.
- Open the file with a good PDF reader (like Evince or GNOME Papers) or metadata inspector/editor (like Paper Clip),
and inspect the document's properties.
Actual Result
The title has not been set into the exported PDF document.
Expected Result
The title should have been set into the metadata, as it is fairly easy to guess from the webpage's title attribute.
If you want to be extra clever about it, you could automatically detect the website/author name from the webpage's metadata or maybe from separators in the title (|, -, —, etc.) and guessing that if what comes after the separator is much shorter than what came before it, it's probably what could be set into the PDF's "author" or publisher metadata field (or whatever approriate equivalents there are).
| Reporter | ||
Updated•1 year ago
|
| Reporter | ||
Comment 1•1 year ago
|
||
Bonus points if the PDF "creation date" and/or "modification date" metadata can also be encoded into the resulting file, when they can be somewhat reliably obtained from the webpage's metadata. I don't know if there is a good trick to this.
For example, in this article we can see things like datePublished and dateModified …
…in this article you have things like:
<time itemprop="dateCreated" datetime="2024-12-30T10:32:14-05:00"
…in that WordPress blog post you have things like:
<div class="wp-block-post-date"><time datetime="2024-12-16T08:36:57+00:00">December 16, 2024</time></div>
| Reporter | ||
Comment 2•10 months ago
|
||
In case it can be useful as a reference, in https://bugs.webkit.org/show_bug.cgi?id=285313, through Skia, WebKitGTK implemented it this way: https://github.com/WebKit/WebKit/pull/38720
Comment 3•23 days ago
|
||
This was implemented in Firefox's SkPDF backend in bug 1309272. It is now possible to test that (experimentally) as of bug 2001909.
Description
•