Include product-name or UA string in metadata of generated PDFs
Categories
(Core :: Printing: Output, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox100 | --- | verified |
People
(Reporter: dholbert, Assigned: dshin)
References
Details
Attachments
(2 files)
STR:
- Print https://www.example.org using Firefox's built-in "Save to PDF" print backend.
- 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.
Reporter | ||
Comment 1•3 years ago
|
||
Reporter | ||
Comment 2•3 years ago
•
|
||
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
Reporter | ||
Comment 3•3 years ago
|
||
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)
Comment 4•3 years ago
•
|
||
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.
Comment 5•3 years ago
|
||
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.
Comment 6•3 years ago
|
||
Yeah, for reference on macOS we do have the MAC_APP_NAME
in the metadata (CorePrinting takes care of it)
Comment 7•3 years ago
|
||
Yeah, brandShortName
or the AppData's name seem like good fits: https://searchfox.org/mozilla-central/rev/766773ca7e3495a3f1ba365f47dffefdea29e3ee/xpcom/build/XREAppData.h#93
Reporter | ||
Comment 8•3 years ago
|
||
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.
Reporter | ||
Comment 9•3 years ago
|
||
(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 | ||
Updated•3 years ago
|
Assignee | ||
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 13•3 years ago
|
||
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.
Description
•