Installing headless Chrome on Ubuntu
Install Chromium (headless Chrome) on Ubuntru
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
Creating screenshot:
chromium-browser --headless --hide-scrollbars --no-sandbox --window-size=1280,1024 --screenshot=screenshot.pdf http://example.org/
Saving a page to PDF:
chromium-browser --headless --hide-scrollbars --print-to-pdf=page.pdf https://example.com/
References:
- https://chromium.woolyss.com/
- https://gist.github.com/addyosmani/5336747
- https://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line
- https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
Somewhat related: