Printout has incorrectly oriented sheet of PDF-paper, when using the new "use_page_rule_size_as_paper_size" feature, with a landscape-oriented @page size rule
Categories
(Core :: Printing: Output, defect)
Tracking
()
People
(Reporter: dholbert, Unassigned)
References
Details
Attachments
(6 files)
(Filing this preemptively as a followup for bug 1793220.)
STR:
- Start a Firefox build with bug 1793220's patches applied (presumably they'll be in Nightly soon).
- Set the about:config pref
print.save_as_pdf.use_page_rule_size_as_paper_size.enabled
totrue
- Load the attached testcase (which has a 4x3 landscape-oriented rectangle and @page size rule).
- Print to PDF, choosing "Pages per sheet: 2" in our print dialog
- Open the resulting PDF.
EXPECTED RESULTS:
The PDF should show a portrait-oriented sheet of paper, with two landscape-oriented pages shown on it (stacked vertically).
ACTUAL RESULTS:
The PDF shows a landscape oriented sheet of paper, with two landscape-oriented pages shown on it, stacked vertically, with the bottom of the lower one cut off.
It looks like we're neglecting to do the special 2-or-6-pages-per-sheet "flip the orientation" step, when setting up our output page size. (We have some code that's supposed to handle this under HasOrthogonalSheetsAndPages
, but we might be imposing the author page size after we've already passed that code, perhaps?)
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 1•2 years ago
|
||
Reporter | ||
Comment 2•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 3•2 years ago
|
||
Here's the print-to-PDF output for testcase 2, which is just fine.
Reporter | ||
Comment 4•2 years ago
|
||
Aha! I've got some simpler updated STR -- it turns out this doesn't require 2-pages-per-sheet! It just requires a document with landscape-oriented dimensions, in general. It seems that we're mistakenly assuming a portrait-oriented page, when we determine the size/orientation of the output sheet of paper.
Simpler STR:
Steps 1-2: same setup as comment 0 (i.e. use a build with bug 1793220's patches, and the pref enabled).
3. Load the attached "testcase 1" (which has a 4x3 landscape-oriented rectangle and @page size rule).
4. Print to PDF, using default settings.
5. Open the resulting PDF.
EXPECTED RESULTS:
Landscape-oriented "pdf paper".
ACTUAL RESULTS:
The PDF has portrait-oriented paper, though the content is landscape-oriented (and gets clipped as a result).
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 5•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 6•2 years ago
|
||
Notably, print-preview shows the correct/expected result in all cases here. It's only the actual PDF "printout" that ends up with the paper using the wrong orientation.
Reporter | ||
Comment 7•2 years ago
|
||
(It's possible there's a platform-specific issue here, too; I'm using Linux, and I think fchasen wasn't seeing this issue a few days ago when we discussed this issue & he was testing the same patch on macOS.)
Reporter | ||
Comment 8•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 9•2 years ago
|
||
A few notes from looking in pernosco ( https://pernos.co/debug/eo2SDpsaT_RXV38gdGDAmA/index.html#f{m[BDQV,IrR/_,t[KQ,De0j_,f{e[BDQV,IrQZ_,s{af9llAmAA,bChk,uERQJHw,oERzJYg___/ ) in a build with https://phabricator.services.mozilla.com/D160303 applied.
We find ourselves at line 581 here: https://searchfox.org/mozilla-central/rev/b25ff1fab82c2d3a91531ad3735e50422407b163/widget/gtk/nsPrintSettingsGTK.cpp#581
with *aWidth being larger than *aHeight (i.e. we've already got width/height set up as a landscape-oriented size), and we have gtkOrient being GTK_PAGE_ORIENTATION_LANDSCAPE
So we flip width/height again due to gtkOrient to "get into landscape mode". But in fact that gets us a portrait-mode size, since we already had a landscape mode size.
So it looks like internally, we expect our representation of the paper-size to be stored with width <= height
, such that we can flip it per gtkOrient
to produce a landscape-oriented size.
One place where we could fix this is in print.js
where we assign settings.paperWidth
etc. -- we might want to use min/max there to enforce our width<=height
paper size invariant. (There might be a more elegant earlier place to fix this too, to effectively produce the same invariant; e.g. maybe even in nsFrameLoader::PrintPreview
, the first chunk in https://phabricator.services.mozilla.com/D160303 . But that's complicated by the fact that we potentially may or may not have an explicit orientation there as well.)
Comment 10•2 years ago
|
||
As suggested above, this has now been addressed as part of the patch for enabling using at-page size in https://phabricator.services.mozilla.com/D160303 by always treating the size passed by the size rule as portrait
and setting the orientation as needed for the original size.
This matches our handling of default paper size, for instance we only ever pass the letter size as "8 x 11" for either orientation.
Reporter | ||
Comment 11•2 years ago
|
||
Let's just dupe this to bug 1793220, since we're ending up fixing this as part of that bug (preventing this from ever being an issue, hooray!)
Description
•