Printing of PDF attachments sometimes fails (preview ok, actually prints blank)
Categories
(Core :: Printing: Output, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| thunderbird_esr153 | --- | fixed |
| firefox-esr140 | --- | unaffected |
| firefox-esr153 | --- | fixed |
| firefox153 | --- | unaffected |
| firefox154 | --- | wontfix |
| firefox155 | --- | fixed |
People
(Reporter: mozilla, Assigned: emilio)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr153+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:152.0) Gecko/20100101 Firefox/152.0
Steps to reproduce:
Another long-term issue ...
In some rare cases, I can open a PDF attachment inside TB and it's shown completely properly. When printing the file, I end up in an empty sheet. Saving the PDF to a file, opening it with "Preview" or "Acrobat Reader" and printing it from there works fine. I couldn't find a pattern yet.
Actual results:
see above
Expected results:
The PDF file should be printed correctly.
Comment 1•2 months ago
|
||
Bug 2047850 - Printing via system print dialog no longer works on Mac - fixed an issue for v152. But it's indicated as not affecting v140. :(
| Reporter | ||
Comment 2•2 months ago
|
||
I don't know why v140 was added here. I've been seeing this issue - very sporadically - across many macOS and TB versions during the last years. And it applies to my HP LaserJet @home as well as to a Kyocera business printer in the office. And to my impressions, it doesn't depend on just the TB version as an other PDF prints well with the same TB. I assume there must be some race condition in the PDF processing.
Comment 3•2 months ago
|
||
(In reply to Frank Winkler from comment #2)
I don't know why v140 was added here. I've been seeing this issue - very sporadically - across many macOS and TB versions during the last years.
That does call into question whether bug 2047850 will fix it, but still possible.
| Reporter | ||
Comment 4•1 month ago
|
||
BTW: I totally forgot to mention that printing the PDF just with lp also worked fine so there were many ways of printing which worked fine - just TB failed ;) ...
Comment 5•1 month ago
|
||
FWIW, I've had this recently... printing through another application worked.
| Comment hidden (hide) |
Comment 8•1 month ago
|
||
After further investigation, I found at least the current problem is a regression from bug 2034406.
At least this one seems easy to reproduce - but a physical printer is needed.
Comment 9•1 month ago
|
||
Bug 2034406 changed nsPageSequenceFrame::PrePrintNextSheet to render every mozPrintCallback canvas into a recording DrawTarget instead of a real one:
RefPtr recorder = MakeAndAddRef<gfx::DrawEventRecorderMemory>(nullptr);
RefPtr<DrawTarget> canvasTarget = gfx::Factory::CreateRecordingDrawTarget(recorder, referenceDt, ...);
and made the paint side replay it (nsHTMLCanvasFrame.cpp):
if (presContext->Type() != nsPresContext::eContext_Print ||
!canvas-GetMozPrintCallback() ||
!dt.TryToReplaySurface(surface, destRect, srcRect)) {
dt.DrawSurface(surface, destRect, srcRect, ...);
}
TryToReplaySurface is only implemented by DrawTargetRecording (gfx/2d/DrawTargetRecording.cpp:555); the base returns false (gfx/2d/2D.h:1539). When it returns false the fallback draws the snapshot — but that snapshot is a SourceSurfaceRecording, which has no pixels. Result: nothing is painted.
The print destination is a recording DrawTarget only when the job is recorded in a content process for replay in the parent. So:
- Firefox: PDFs always render in a content process → recording destination → replay works.
- Thunderbird: a PDF attachment opens as a content tab on a mailbox:/imap: URL, which is parent-process only (browser.isRemoteBrowser == false). The print destination is a real DrawTarget → replay fails → every pdf.js page canvas paints nothing → blank sheets, while the viewer and the print preview both look correct (preview goes through HandlePrintCallback/on-screen painting, not this path.)
Assisted by Claude.
Updated•1 month ago
|
Comment 10•1 month ago
|
||
Set release status flags based on info from the regressing bug 2034406
| Assignee | ||
Comment 11•1 month ago
|
||
Updated•1 month ago
|
Comment 12•1 month ago
|
||
D318194 seems alright in my testing
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 13•1 month ago
|
||
Comment 14•1 month ago
|
||
| bugherder | ||
| Assignee | ||
Comment 16•1 month ago
|
||
This doesn't affect Firefox so no unless Thunderbird needs it.
Updated•1 month ago
|
Comment 17•1 month ago
|
||
As 153 is esr, it would be good to uplift there, so Thunderbird ESR users don't run into this for the next year.
Comment 19•1 month ago
|
||
firefox-esr153 Uplift Approval Request
- User impact if declined/Reason for urgency: Affects Thunderbird.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Relatively minimal change.
- String changes made/needed?: none
- Is Android affected?: yes
| Assignee | ||
Comment 20•1 month ago
|
||
The implementation living in DrawTargetRecording.cpp is slightly
annoying but makes things easier, wdyt?
Alternative would be to move this to a
SourceSurfaceRecording::TryToReplayInto(DrawTarget*) or so.
Original Revision: https://phabricator.services.mozilla.com/D318194
Updated•1 month ago
|
Updated•1 month ago
|
Comment 21•1 month ago
|
||
| uplift | ||
Updated•1 month ago
|
Updated•1 month ago
|
| Reporter | ||
Comment 24•1 month ago
|
||
Just out of curiosity: what was the actual problem and what triggered it? I'm not deep enough in the source code to figure out what the above snippets (should) do or don't.
And the reason for "won't fix in FF 154" is that it was just about to be replaced by 155?
Description
•