Skip to content

Instantly share code, notes, and snippets.

@g-P
Created July 30, 2014 13:48
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save g-P/cbdfd4a4b982ba8fa04b to your computer and use it in GitHub Desktop.
Save g-P/cbdfd4a4b982ba8fa04b to your computer and use it in GitHub Desktop.
Eloquent Javascript
#!/bin/bash
while read p; do
f=${p##*/}
f=${f//html/pdf}
# Download wkhtmltopdf from http://wkhtmltopdf.org/
wkhtmltopdf $p $f
done <eloquent_chapters.links
"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o eloquent.pdf *.pdf
@n2j3
Copy link

n2j3 commented Jul 31, 2014

adding top and bottom margins adds a lot to the 'readibility' of the final .pdf

wkhtmltopdf -B 10mm -T 10mm $p $f

Those with a patched qt can also add page numbers if they so desire. wkhtmltopdf is wonderful indeed. Thanks for the script g-P!

For the non-privileged, pdftk will also combine the extracted chapters just fine.

pdftk file1.pdf file2.pdf cat output combined.pdf

@g-P
Copy link
Author

g-P commented Jul 31, 2014

Thanks for the tip. Cheers 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment