New issue
Advanced search Search tips

Issue 766858 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 724160
Owner: ----
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[headless] Support setting the PDF page size from CSS, like print preview can

Project Member Reported by zoeclifford@chromium.org, Sep 19 2017

Issue description

See attached HTML. It's CSS specifies a tiny page that's twice as tall as wide with no margins.

When using Print Preview's "Save as PDF" the output "paper" will have this size.

However when using headless / devtools printToPDF this is impossible. Some stuff is taken from the CSS, but ultimately the page size will always match paperWidth and paperHeight.





 
index.html
346 bytes View Download
desired.pdf
18.0 KB Download
Cc: thestig@chromium.org
Looking at print_render_frame_helper.cc I suspect like the main issue is that print_scaling_option is forced to kWebPrintScalingOptionFitToPrintableArea [1][2] without any way to override that from headless_print_manager.cc

thestig@, I heard you were a good person to get hints from about this. Any thoughts?

[1]
https://cs.chromium.org/chromium/src/components/printing/renderer/print_render_frame_helper.cc?rcl=24df7839c6a83a2587cfa87c4eac64451a654e69&l=1746
CalculateNumberOfPages sets fit_to_paper_size to true.
[2]
https://cs.chromium.org/chromium/src/components/printing/renderer/print_render_frame_helper.cc?rcl=24df7839c6a83a2587cfa87c4eac64451a654e69&l=1734
InitPrintSettings sets print_scaling option to kWebPrintScalingOptionFitToPrintableArea



This sounds like bug 724160...
Mergedinto: 724160
Status: Duplicate (was: Untriaged)
I replied on bug 724160. Thanks for attaching an example that does not blind my eyes. :)

Sign in to add a comment