Open Bug 1939532 Opened 1 year ago Updated 23 days ago

When saving to PDF, automatically set the title metadata attribute from the webpage's title

Categories

(Core :: Printing: Output, enhancement)

Firefox 133
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: nekohayo, Unassigned)

References

Details

Basically as the title says.


Steps to reproduce

With Firefox 133 from Fedora 41's repositories:

  1. From any webpage (particularly a news article, for example), hit Ctrl+P.
  2. Choose "Save to PDF" as the output, instead of a physical printer.
  3. Save the file.
  4. 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).

Has STR: --- → yes
OS: Unspecified → All
Hardware: Unspecified → All
Version: unspecified → Firefox 133

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>

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

See Also: → 1950656

This was implemented in Firefox's SkPDF backend in bug 1309272. It is now possible to test that (experimentally) as of bug 2001909.

Depends on: 2001909, 1309272
You need to log in before you can comment on or make changes to this bug.