Skip to content

Instantly share code, notes, and snippets.

@nravic
Last active July 14, 2016 16:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nravic/ce7786ffe5a67dd7abd4517fe080544f to your computer and use it in GitHub Desktop.
Save nravic/ce7786ffe5a67dd7abd4517fe080544f to your computer and use it in GitHub Desktop.
wkhtmltopdf wrapper for downloading entire websites and saving 'em as pdfs
#wkhtmltopdf wrapper for multiple html input and other oddities
#requires wkhtmltopdf with patched QT library
#!bin/bash
echo "Enter webpage url to download and save as pdf, followed by [ENTER]:"
read url
echo "Enter name to save pdf as, followed by [ENTER]:"
read output
wget -r --no-parent -P temp_dir/ $url && cd "$_" > /dev/null 2&>1
temp=""
for i in $(find -name *.html)
do
temp="$temp $i"
done
wkhtmltopdf $temp ${output}
rm -r temp_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment