Skip to content

Instantly share code, notes, and snippets.

@enliven-
Forked from g-P/print_gitbook.js
Created June 28, 2014 22:29
Show Gist options
  • Save enliven-/dab62d5d5b904a48d70e to your computer and use it in GitHub Desktop.
Save enliven-/dab62d5d5b904a48d70e to your computer and use it in GitHub Desktop.
/*
If you try to print a gitbook directly, you get nothing but the contents because of their *just* use of `@media print` styling to hide away the content section of the books.
Fret not, here is the codez:
*/
$(".book-header,.book-summary,.navigation,.book-progress").remove();
$(".book.with-summary .book-body").css('left', '0px');
$("*").css('position', 'static');
window.print()
/*
You still have to run this for each chapter page to save the chapter as pdf and club them together later(this is drag and drop on mac). You can further use calibre to convert to kindle or whatever you need.
Perhaps some one will go one step more to write a node.js utility to print git books.
But hey, do buy the books to support the authors.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment