New issue
Advanced search Search tips

Issue 910588 link

Starred by 5 users

Issue metadata

Status: Unconfirmed
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Excessive PDF size when background-image doesn't fit print layout height

Reported by alexey.v...@gmail.com, Nov 30

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36

Steps to reproduce the problem:
1. Use HTML page which only contains <div> with background-image style: <div style=" background-image: url('https://...')">. Image height should be larger that output "paper size" height, and the image bottom should be cut off to fit in the output dimensions.
3. Save this HTML page as PDF

What is the expected behavior?
Output PDF size corresponds to initial JPG file size

What went wrong?
Output PDF size is nearly 10 times larger than initial JPG file size

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 70.0.3538.110  Channel: stable
OS Version: OS X 10.14.1
Flash Version: 

Reproduces for:
1. Chrome "Print" with destination "Save to PDF" on UI
2. Headless mode "convertToPdf" via Puppeteer.

Some testing cases:
350kb jpg as background-image is resulting to:
0.5Mb PDF when 1380x1953pixels initial jpg is saved to A4 layout
4.5Mb PDF when 1380x1995pixels initial jpg is saved to A4 layout (too big height to fit in to A4 layout dimensions)
4.3Mb PDF when 1311x1953pixels initial jpg is saved to US Letter layout (too big height to fit in to US Letter layout dimensions)
 
Components: Internals>Printing
Sounds like  bug 897732 .
Labels: Needs-Triage-M70
Cc: halcanary@google.com
Sorry for duplicating if it's the case.
Have read everything at https://bugs.chromium.org/p/chromium/issues/detail?id=897732 ,
and it looks like using the suggested workaround with scaling the images before creating the PDF is not really acceptable approach, because we are not controlling the images while we run the Puppeteer.
And the bug is still existing and actual.
Labels: Triaged-ET
As per comment #2, as this issue seems to be a duplicate of  issue 897732 ,  requesting halcanary@ to look into the issue and provide an update.

Thanks..
Thank you.
I would like to add a significant concern: in case the user prints the page as PDF, we cannot know the correct image dimensions because the user can choose any layout (A4, letter).
Owner: thestig@chromium.org
Status: Untriaged (was: Unconfirmed)
Mac triage: thestig@, do you understand this issue report?
Status: Assigned (was: Untriaged)
This issue has an owner, a component and a priority, but is still listed as untriaged or unconfirmed. By definition, this bug is triaged. Changing status to "assigned". Please reach out to me if you disagree with how I've done this.

Comment 10 by thestig@chromium.org, Jan 16 (6 days ago)

Cc: thestig@chromium.org
Labels: Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
original bug reporter: Can you provide some sample HTML, CSS, and/or images for this issue?

re: comment 5 - Can you file a bug for your own issue instead of commenting on other people's issues?

Comment 11 by alexey.v...@gmail.com, Jan 17 (6 days ago)

Thank you for response.
And sorry for the mess with comment 5: it's my comment from another account.

The sample is attached, should be printed as A4 Portrait without margins in order to reproduce. 

Archive.zip
355 KB Download
Project Member

Comment 12 by sheriffbot@chromium.org, Jan 17 (6 days ago)

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment