3 ms·
This is exactly what I do bundled into a nice function added to my .zshrc chromepdf() { chrome --headless --disable-gpu --print-to-pdf="$1" $2
by xilni 9y ago
This is exactly what I do bundled into a nice function added to my .zshrc
chromepdf() {
chrome --headless --disable-gpu --print-to-pdf="$1" $2
}
- zulln 9y agoWhat do you use this for?
- nsomaru 9y agoSave a webpage as a PDF
- zulln 9y agoDid not mean to sound negative, but what is the use-case of saving web pages as PDFs? I understand building in the functionality in something else, but here it sounds like you manually type/paste in URLs on a regular basis. Edit, I see now that I replied to the wrong comment. It was meant to they who made an alias to it.
- sgolestane 9y agoIs there anyway to make chrome wait until the page loads?
- lashkari 9y agoLooks like it prints automatically once Page.loadEventFired is triggered. Alternatively, you can run Chrome headless with the remote debugging API (--remote-debugging-port=9222) and send a Page.printToPDF (https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF https://chromedevtools.github.io/devtools-protocol/tot/Page/...) after some delay.