Corion / WWW-Mechanize-Chrome

automate the Chrome browser
https://metacpan.org/release/WWW-Mechanize-Chrome
Artistic License 2.0
30 stars 12 forks source link

Add example how to setup pagesize #28

Closed KES777 closed 6 years ago

KES777 commented 6 years ago

When I save pages as pdf they are saved us US Letter

here I can see an examples that chrome allow parameter to set page size:

await page.pdf({path: 'page.pdf', format: 'A4'});

I did not find how to setup this with help of your module. If this is possible may you please create an example?

I try to workaround that with @page{ size: A4 } but there is bug in Chrome

KES777 commented 6 years ago

info: https://chromedevtools.github.io/devtools-protocol/tot/Page#method-printToPDF

Corion commented 6 years ago

Heh - ->content_as_pdf and ->render_content pass their options through, so the following should already work even though it is undocumented:

my $pdf = $mech->content_as_pdf( format => 'A4' );

I'll add that to the documentation, thanks for reporting this!

Corion commented 6 years ago

Released as 0.20, thanks!