Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page.printToPdf has no configuration options (paper size, orientation, margins, etc) #13

Closed
venkat-rg opened this issue May 8, 2017 · 3 comments
Assignees
Labels

Comments

@venkat-rg
Copy link

Hi,
I have been using the serverless-chrome for over a week. I have come across an issue. printPdf function doesn't allow any options. For eg: to create pdf with no margin (or margin: 0). Please help on how to get the pdf with no margin to the end of each side.
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF

@adieuadieu adieuadieu self-assigned this May 8, 2017
@adieuadieu
Copy link
Owner

Hi @venkat-rg. Yes; you're absolutely right.

Headless Chrome is still rather new and currently doesn't expose any configuration options (paper size, orientation, margins, etc) for printing to PDF. The good news is that people on the Chromium team are working on it. You can follow their progress on pdf-options here. There's a pending code-review here. Once this is merged, hopefully we'll get some options to control margins, etc.

You can get some sense of the what the configuration options will be from the modifications to the Chrome Debugging Protocol here.

@adieuadieu adieuadieu changed the title Page.printToPdf doesnot obey options. Page.printToPdf has no configuration options (paper size, orientation, margins, etc) May 8, 2017
@venkat-rg
Copy link
Author

Thanks for quick help.

@adieuadieu
Copy link
Owner

@venkat-rg Looks like the code has been merged. I've updated the chromium headless shell in this repository to the latest. It looks like the DevTools API documentation for Page.printToPDF has also been updated. You can now use these options.

Closed by #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants