All Projects → lwchkg → gitbook-pdfgen

lwchkg / gitbook-pdfgen

Licence: Apache-2.0 license
PDF generator(s) for GitBook

Programming Languages

javascript
184084 projects - #8 most used programming language

GitBook PDF Generator(s)

Documentation is not finished yet. Before the documentation is done, you may check the discussion at https://github.com/GitbookIO/gitbook/issues/1470 for ideas.

Installation

  1. npm install -g gitbook-pdfgen
  2. Install wkhtmltopdf and add wkhtmltopdf to path.
  3. Download the sample project at https://github.com/GitbookIO/gitbook/issues/1470 to project path
  4. cd [project path] && npm install && gitbook install
  5. run gitbook-pdfgen at the project path, which contains book.json. The pdf generated is book_wk.pdf
  6. run gitbook-pdfgen --help for help of the command line.
  7. Modify the book.

Configuration

  • Do the configuration in book.json of the book.
  • Check gen_pdf_wk_config_schema.json in the npm package for details. (Sorry I cannot pretty print the schema yet.)
  • Check the sample project and wkhtmltopdf help for how to modify the TOC, header and footer.

Known issues

  • If a font-face is not used in the first page (usually README.md), the font will not be embedded correctly in the pdf. This is an issue with wkhtmltopdf. (Workaround: see the sample project to add some hidden text.)
  • Will not work if the book summary is not in the same format as the sample project. (i.e. One part only, no multilanguage.)
  • Cannot set a different margin in different pages, including cover. (Workaround: to add a real cover to your book, use PDFTK Builder.)
  • Will not work if the book contains a book.js instead of book.json.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].