Skip to content

Instantly share code, notes, and snippets.

@lesterlo
Last active July 11, 2024 03:24
Show Gist options
  • Save lesterlo/d58a09a7a1790741435f574bcd8f45be to your computer and use it in GitHub Desktop.
Save lesterlo/d58a09a7a1790741435f574bcd8f45be to your computer and use it in GitHub Desktop.
Build a gitbook from source to PDF
# https://stackoverflow.com/questions/58498643/no-result-or-error-when-using-gitbook-pdf
# Must use calibre-3.48.0, https://download.calibre-ebook.com/3.48.0/
# Otherwise, no photo will be generated
$ ln -s /Applications/calibre.app/Contents/MacOS/ebook-convert /opt/homebrew/bin/ebook-convert
$ npm install @gitbook-ng/gitbook
$ npx gitbook pdf ./ ./mybook.pdf
# Error: Couldn't locate plugins "yahei, code, katex, splitter, github-buttons, disqus, search-plus, sharing-plus, expandable-chapters-small, image-captions, anchor-navigation-ex-toc, hints, custom-favicon", Run 'gitbook install' to install plugins from registry.
$ npx gitbook install
$ npx gitbook pdf ./ ./mybook.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment