前言
关于新版的gitbook,官方已经不支持导出pdf等电子书格式,官方的解读如下:
截止到20191103官方暂未支持导出pdf,未来可能添加该功能
PDF and other ebook formats exports ?
The new version of GitBook no longer supports exporting to PDF and other ebooks format. A lot of rich-content does not translate well from the Web to PDF. GitBook will expose a developer API for people to consume and extend their content. It is not excluded that someone build a PDF export tool using the API, but it will not be officially supported. See the section about offline access if this is the part you cared about.
但是并不意味着就不能用其他方法生成,网上检索和测试了几种方法,这里作一下记录和分享
声明: 以下方法使用系统均为ubuntu 18.04
,windows请自行探索!!
方法一:
- 安装npm
sudo apt install npm
- 安装gitbook
sudo npm install gitbook -g
sudo npm install gitbook-cli -g
- 安装calibre
sudo apt install calibre
- 进入放置
SUMMARY.md
的目录 - 执行生成命令
sudo gitbook pdf
等2分钟就能生成啦,会有以下提示!!注意第2第3步骤,因为网络环境都有失败的可能,最好挂上VPN进行下载安装。
方法二:
参考以下网友的链接:gitbook2pdf
输入个人gitbook主页链接,并不能正常生成pdf(空白页面),但是示例链接仿佛没有问题,估计还是gitbook网站改版的问题。