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.
npm install -g gitbook-pdfgen
- Download the sample project at https://github.com/GitbookIO/gitbook/issues/1470 to project path
cd [project path]&&
gitbook-pdfgenat the project path, which contains book.json. The pdf generated is book_wk.pdf
gitbook-pdfgen --helpfor help of the command line.
- Modify the book.
- Do the configuration in book.json of the book.
gen_pdf_wk_config_schema.jsonin 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.
- 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.