Closed Bug 1762258 Opened 2 years ago Closed 2 years ago

Include product-name or UA string in metadata of generated PDFs

Categories

(Core :: Printing: Output, task, P3)

task

Tracking

()

VERIFIED FIXED
100 Branch
Tracking Status
firefox100 --- verified

People

(Reporter: dholbert, Assigned: dshin)

References

Details

Attachments

(2 files)

STR:

  1. Print https://www.example.org using Firefox's built-in "Save to PDF" print backend.
  2. Inspect the metadata on the generated PDF; e.g. in Ubuntu/Gnome, right-click the file and choose "Properties" and then the "Document" tab.

ACTUAL RESULTS:

  • "Creator" field is None
  • "Producer" field is cairo 1.17.4 (https://cairographics.org)
  • No mention of Firefox or a browser in the metadata.

EXPECTED RESULTS:

  • Perhaps "Creator" should be set to Firefox (or to our User Agent string, or something else to indicate the product that created it)?

I'm not sure what conventions are around PDF metadata; I'll post a few notes on what other software seems to do in subsequent comments.

So for comparison, below are the Producer/Creator field values that are shown in my screenshot.

Firefox and Safari show "Actual Results" (just showing the PDF-generation backend as Producer, with Creator:None and no mention of the browser).
Chrome shows comment 0's tentative "expected results" here (i.e. Chrome puts its UA string in the Creator field).
LibreOffice puts its product name in both Producer and Creator (I'm not suggesting we should do that; just noting it as another data-point).

FIREFOX on Ubuntu (Print | Save to PDF)
Producer: Cairo 1.17.4 (https://cairographics.org)
Creator: None

SAFARI on macOS (File | Export as PDF)
Producer: macOS Version 12.3 (Build 21E230) Quartz PDFContext
Creator: None

CHROME on Ubuntu (Print | Save to PDF)
Producer: Skia/PDF m101
Creator: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36

LIBREOFFICE on Ubuntu (Print | Print to file...)
Producer: LibreOffice 7.2.6.2
Creator: LibreOffice 7.2.6.2

CC'ing jfkthame and emilio since I think they've worked with our PDF-generation code most-extensively/recently, in bug 454059 and bug 1760836.

This probably isn't super high-priority, but while it's maybe-fresh-in-your-minds: do either of you happen to know where this sort of change might fit in in the code? (i.e. where [if anywhere] we might have an opportunity to inform cairo about the metadata fields for the PDF that it generates for us)

I think we could basically call cairo_pdf_surface_set_metadata with the CAIRO_PDF_METADATA_CREATOR tag immediately after creating the cairo pdf context.

So somewhere about here.

One question would be what string to pass. Looks like Chrome uses the UA string, though I'm inclined to think the product name might be friendlier.

Yeah, for reference on macOS we do have the MAC_APP_NAME in the metadata (CorePrinting takes care of it)

Thanks, guys!

Side note: in bug 1759821, the reporter provided a screenshot where the metadata has an empty field that's labeled "Application" instead of "Creator" -- that's attachment 9268427 [details].

I don't see that field-name locally (in Ubuntu's view of the PDF properties), so I'm guessing that's just an alternate choice of frontend-label for the same "Creator" field. Not sure, though.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #6)

Yeah, for reference on macOS we do have the MAC_APP_NAME in the metadata (CorePrinting takes care of it)

Indeed -- for Firefox (Nightly) Save-to-PDF output on Mac, I end up with this metadata in the PDF:

Producer: macOS Version 12.3 (Build 21E230) Quartz PDFContext
Creator: Firefox Nightly

That seems reasonable / worth matching on other platforms.

Assignee: nobody → dshin
Status: NEW → ASSIGNED
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/18ea8054f08a
Add product name to printed PDF's "Creator" metadata field. r=dholbert
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
Flags: qe-verify+

I was able to reproduce the issue before fix on Ubuntu20.4 100.0a1 (20220330214842).
Verified on Beta 100.0b5 (20220412185818) that:

  • on Ubuntu 20.4 Creator = 'Mozilla Firefox'
  • on Mac 10.13 Creator = 'Firefox'
  • on Win10 there is no creator for the file.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: → 1830086
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: