Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome headless in Ubuntu

I'm trying to use chrome headless print to pdf option to print some pdf Files in ubuntu and here's my command line :

google-chrome --headless --disable-gpu --print-to-pdf  http://www.google.com

Now if I ran it like that it runs perfecly and the file is generated.

BUT when I add the name of the file after --print-to-pdf :

google-chrome --headless --disable-gpu --print-to-pdf gen.pdf http://www.google.com

an error occur :

[1213/020159.194304:ERROR:headless_shell.cc(605)] Open multiple tabs is only supported when remote debugging is enabled.

Any solution to this ? thx.

like image 629
Moatez Bouhdid Avatar asked Dec 13 '17 10:12

Moatez Bouhdid


1 Answers

You're missing an = between --print-to-pdf and gen.pdf.

This should work:

google-chrome --headless --disable-gpu --print-to-pdf=gen.pdf http://www.google.com

Similar question asked here

like image 99
Emil Hernqvist Avatar answered Oct 22 '22 06:10

Emil Hernqvist