Landscape printing is cut off/scaled incorrectly.
Categories
(GeckoView :: General, defect)
Tracking
(Not tracked)
People
(Reporter: fauxio, Unassigned, Mentored)
References
Details
(Whiteboard: [geckoview:2024H2?][geckoview:introduction])
Attachments
(2 files)
Steps to reproduce:
- Navigate to any website such as amazon.com or google.com.
- Press the 3 dots in the lower right and hit print or the share icon > print.
- Switch the orientation to landscape with any printer or save to PDF selected.
Actual results:
You will notice that the content will not fill the width of the page preview no matter what. If you attempt to fill the width of the page using CSS rules (setting html width to 11in+ with letter paper size), the content will be cut off on the right. Changes to @page rules do not seem to remedy this.
It seems to me that portrait orientation and boundaries are preserved and scaled to fit vertically inside the landscape page (11in height scaled down to 8.5in height and width scaled from 8.5in to ~6.56in to preserve orientation)
Expected results:
The page boundaries should have changed to match the landscape orientation, and no scaling should have occurred.
This issue does not exist in Chrome for Android.
Comment 2•1 year ago
|
||
The severity field is not set for this bug.
:boek, could you have a look please?
For more information, please visit BugBot documentation.
Comment 3•11 months ago
|
||
Redirecting this one to :olivia
Comment 4•11 months ago
|
||
In general, for us to have better printing or PDF generation, we need to open up some more print settings on the Gecko side in bug 1770971 to Android. We also generate a PDF using the Gecko printing framework for both printing and saving a PDF.
Relevant default Gecko PDF/Printing settings we are using are here in nsWindow.cpp. The idea of bug 1770971 is to open the API so the user can specify more about how the document prints (like in desktop).
It seems to me that portrait orientation and boundaries are preserved and scaled to fit vertically inside the landscape page:
For this case, I suspect we can maybe improve the experience some without bug 1770971 by:
- First checking if we go through this code path in
nsPrintJob.cpp
. I'm not sure if we go through there, but it might be worth looking deeper into for use and potential Android bugs.
Directly check for screen orientation:
- Checking the screen orientation in the
nsWindow
and changing the settings here- Likely can check using
GetScreenOrientation()
- Suspect there might be another more universal way of checking screen orientation
- Likely can check using
- Use SetOrientation to set the setting based on the orientation
- Bug 1841089 has a similar patteren to the suggestion I have above. I abandoned that patch because of some unexpected behavior in certain conditions and time constraints, but it could be a patteren to approach this bug from on in terms of tests and how the code will look.
setting html width to 11in+ with letter paper size), the content will be cut off on the right
I think this might be a symptom of not checking for screen orientation as well. Would recommend testing this after the above suggestionis implemented.
Switch the orientation to landscape with any printer or save to PDF selected.
This suggestion above will likely only work before reaching the print screen. To connect it to the Android Print UI as well:
(Recommend filing a new bug for this approach. The below is very much a workaround and working on bug 1770971 first is the more robust solution, since we can directly tie each Gecko setting to the corresponding Android UI. )
- Check
onLayout
for new landscape settings changes. - Send a request to regenerate the PDF for printing to Gecko.
GeckoViewPrintDocumentAdapter
already has a generated PDF, so we need a way to send off the request to get a new PDF of this orientation for printing.
Comment 5•11 months ago
|
||
This is a good first GeckoView bug, but maybe too involved with checking if something is going on in nsPrintJob.cpp
and has too many Gecko printing research needs for an overall good-first-bug
.
If just checking screen orientation and setting the cooresponding print setting, then the bug is straight forward.
Updated•11 months ago
|
Description
•