Saving a web page to PDF#
The shot-scraper pdf
command saves a PDF version of a web page - the equivalent of using Print -> Save to PDF
in Chromium.
shot-scraper pdf https://datasette.io/
This will save to datasette-io.pdf
. You can use -o
to specify a filename:
shot-scraper pdf https://datasette.io/tutorials/learn-sql \
-o learn-sql.pdf
You can pass the path to a local file on disk instead of a URL:
shot-scraper pdf invoice.html -o invoice.pdf
shot-scraper pdf --help
#
Full --help
for this command:
Usage: shot-scraper pdf [OPTIONS] URL
Create a PDF of the specified page
Usage:
shot-scraper pdf https://datasette.io/
Use -o to specify a filename:
shot-scraper pdf https://datasette.io/ -o datasette.pdf
You can pass a path to a file instead of a URL:
shot-scraper pdf invoice.html -o invoice.pdf
Options:
-a, --auth FILENAME Path to JSON authentication context file
-o, --output FILE
-j, --javascript TEXT Execute this JS prior to creating the PDF
--wait INTEGER Wait this many milliseconds before taking the
screenshot
--media-screen Use screen rather than print styles
--landscape Use landscape orientation
-h, --help Show this message and exit.