I need help one more time. I am trying to print a page to pdf using headless feature of the chrome. However, header and footer is present in the pdf. I found that this option as been implemented in Devtools.
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
However, i can't find how can i use these options in CLI. Also is it possible to invoke the Devtools from selenium?
Additionally how can i invoke Page.PrintToPDF in Dev tools. I tried to run the command in Console. It is showing Page is undefined.
Add this CSS to the page your creating into a PDF to remove Chrome Headless's implemented Header and Footer.
CSS:
You should format your command like below to create the PDF:
Example 1:
Example 2:
You can also test this functionality by navigating in your command line to the folder containing Chrome executable file, and running this command: