New issue
Advanced search Search tips

Issue 769204 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 2
Type: Bug



Sign in to add a comment

Images at the page bottom are not printed

Reported by martins....@gmail.com, Sep 27 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. Open the attached file bottom-elements.html with Chrome/Chromium
2. Press Ctrl/Cmd+P to open print preview
3. Verify that in Print settings Layout is set to "Portrait", Paper Size set to "A4", and Margins is set to "None"
4. Set Destination to "Save as PDF" and press "Save" to save the PDF file on disk.

What is the expected behavior?
1. In print preview and in the resulting PDF, there should be one page visible with four identical images visible in each page corner.
2 Printing to PDF with Chromium Headless, the output should be the same as in (1).

What went wrong?
1. Observe that, in print preview, there are two red rectangles visible at the bottom of the page while on the top there are two identical images.
2. Note that in the original page these bottom rectangles are fully hovered by an image, thefore rectangles are not visible.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100  Channel: stable
OS Version: 
Flash Version: 

The red background color is set for illustration purposes.
The page size is chosen to correspond to A4 paper size in 96dpi.
 
bottom-elements.html
1.6 KB View Download
highway.jpg
26.2 KB View Download
Components: UI>Browser>PrintPreview
Labels: Needs-Triage-M61
Components: Blink>Layout
Labels: OS-Windows
Reproduces on Windows.

Tested with Print Browser mode and this has issues there as well, so adding Blink>Layout label. In print browser mode it looks like the bottom images are shifted down so that the red boxes show up underneath them, and only the tops of the images are visible. This is similar to what happens if you use default margins + Letter paper in Print Preview (the tops of the images move down to a second page).

Comment 3 by e...@chromium.org, Sep 28 2017

Status: WontFix (was: Unconfirmed)
Unable to reproduce when set to portrait and no margins. If I change the size of the margins or the paper size however it does reproduce in that the bottom images gets pushed to the next document leaving the red boxes on the first page.

This is by design in that we do not split images across pages, if they do not fit *completely* on a page they get pushed to the following page.

Adjust the position to ensure that the images fit on page, or better yet, position them relative to the desired corner.

i.e.
top: 0, left: 0 for top left
top: 0, right: 0 for top right
bottom: 0, left: 0 for bottom left
bottom: 0, right: 0 for bottom right
Thank you all for looking into this issue.

As I mentioned, I sized the '.container' div to match A4 paper size (in 96dpi) as closely as possible, however I realized that I rounded both dimensions up, not down, therefore there was a possibility that  my paper size does not fit A4 completely. That's why I shrinked the .container size by one pixel in both dimensions and added a new attachment, bottom-elements-1.html, for the sake of correctnesss.

> Unable to reproduce when set to portrait and no margins. 
Nevertheless the print preview of bottom-elements-1.html still looks like in the attached screenshot, even though the layout is set to "Portrait", "Paper size" is "A4", and there are no print margins.
Testing in Chrome 61.0.3163.100 (Stable) Version 63.0.3223.8 (Official Build) dev, Arch Linux 64bit.

> This is by design in that we do not split images across pages, if they do not fit *completely* on a page they get pushed to the following page.
But they do fit completely. <Top coordinate of a bottom image> + <image container height> <= <height of the container>, i.e., 929 + 193 = 1022 (please see the newly added attachment, bottom-elements-1.html for correct numbers)
Moreover, if they should be pushed to the following page, then there should be more than one page both in the print preview and in the saved PDF.


> Adjust the position to ensure that the images fit on page, or better yet,
> position them relative to the desired corner.
>
> i.e.
> top: 0, left: 0 for top left
> top: 0, right: 0 for top right
> bottom: 0, left: 0 for bottom left
> bottom: 0, right: 0 for bottom right
Yes, of course, that way it may work, however in our case, we're working on a WYSIWYG tool for authoring pages where we place objects respecting their (x,y) coordinates, something like `style='left: ' + x + 'px;top: ' + y + 'px;'`, therefore we don't have any control of where user places his/her object and resorting to right/bottom workarounds seems quite painful.

Again, thank you very much for looking into this issue.

bottom-elements-1.html
1.6 KB View Download
screenshot-bottom-images-print-preview.png
242 KB View Download
OK, I found a workaround: adding CSS property `display: inline-block` to the .container element makes bottom images come back, however this produces the second page which is blank. 

Sign in to add a comment