# Install prereqs with Homebrew: # # uninstall moreutils if installed: # `brew uninstall moreutils` # # brew install wget # brew install poppler # brew install parallel # brew install moreutils --without-parallel set -e BASE="https://www.vaultproject.io/" wget --spider -nd -r "${BASE}docs/index.html" --no-parent -nv -o - | while read line; do echo $line | grep -o "https://[^ ]\+" | grep ".html$" | sed -E "s=${BASE}(.+)=\1 ${BASE}\1="; done | parallel -t -C' ' 'mkdir -p {1//}; /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --print-to-pdf={1.}.pdf {2}' find docs -name index.pdf | while read line; do mv $line $(echo $line | sed 's/index.pdf/_.pdf/'); done mkdir -p out find -s docs -iname "*.pdf" | parallel -X 'pdfunite {} out/{#}.pdf' pdfunite $(ls -1 out/*.pdf | sort -n) out/vault.pdf