gitbook export markdown file in pdf format

Foreword
I would like to complete the operation as shown in the title, but the twists and turns in the online search for a long time, under the tutorial is not under mac OS Linux tutorials, and a lot of windows tutorial can understand that very few, in the spirit of sharing attitude, organize special tutorials today as follows:

First, install nodejs

Enter the official website:   http://nodejs.cn/download/, and click on the corresponding version shown in Figure locate and download the installation package:

Double-click the installation package nodejs, the default npm also check on the installation, select a custom installation path, for example: D: \ Program Files \ nodejs, this time nodejs should have been added to the environment variable, and if not you can add your own hand.

View nodejs Version:
execution npm -version can view the version, as shown below:

Second, download gitbook tool

Before installation can be installed to change my source, the default is foreign, into the country, or subsequent installation you will have the urge to cry ~ ~

Open the D: \ Program Files \ nodejs \ node_modules \ npm \ npmrc file, add the following configuration:

registry=http://registry.npm.taobao.org 

Storage arrangement.

Then enter the command: npm install gitbook-cli -g, global installation gitbook.

See if gitbook tool has been successfully installed, use the command: gitbook -V
while this command will automatically install gitbook

As a result it would indicate that the case of FIG. Gitbook successful installation.

Third, the production PDF

To download two plug-ins:

3.1 phantomjs

Enter https://bitbucket.org/ariya/phantomjs/downloads/ download PhantomJS :

The downloaded archive decompression, and add the unpacked directory to the environment variable.

After installation is complete, view the version: phantomjs --version

 

 

It represents a successful installation.

3.2 calibre

Enter https://calibre-ebook.com/download_windows download calibre:

After downloading the software directly installed and the installation directory to the environment variable, installed by default in:

C:\Program Files (x86)\Calibre2

Installation can be found in the link: https:? //Jingyan.baidu.com/album/6079ad0eb87aa328fe86db6a.html picindex = 1.

Click Next to direct, do not fill anything in the mail.

View Version: calibre -v

3.3 plug-ins are installed and configured environment variables, then we can install the gitbook-pdf:

npm install gitbook-pdf -g 

View Version: gitbook-pdf --version

gitboot-pdf after a failed installation, the installation still fails again to address:

View Log: Delete gitbook-pdf-related installation files:

C:\Users\Administrator\AppData\Roaming\npm-cache\_logs

After successful installation: The following will be: gitbook-pdf-related configuration information. Need to remove and re-install the installation fails.

C:\Users\Administrator\AppData\Roaming\npm

C:\Users\Administrator\AppData\Roaming\npm\node_modules

Third, generate a PDF file

Before switching to write your own e-book file directory (shift + right: the current directory Open a command line window), or downloaded from the Internet e-book file, execute the following command:

gitbook pdf ./mybook

The resulting PDF file that your e-book file directory mybook inside.

Questions about gitbook build the generated HTML can not skip chapters
such as the title, as mentioned above problems, gitbook high probability version you are using is too high, the solution is as follows:
gitbook reduced version to 2.6.7 on it, use the following command:

gitbook build --gitbook=2.6.7

IV Notes

1, the local environment variable: use the standard yellow.

E:\ProgramFiles\Java\jdk1.7.0_80\bin;%MAVEN_HOME%\bin;E:\ProgramFiles\Java\jdk1.7.0_80\jre\bin;C:\Program Files (x86)\VanDyke Software\Clients\;C:\Users\Administrator\AppData\Local\BypassRuntm;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Local\Yarn\bin;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;E:\phantomjs-1.9.7-windows\phantomjs-1.9.7-windows;C:\Program Files (x86)\Calibre2

Which when phantomjs environment variable configuration, is to configure the directory where the .exe file to a path can be.

When calibre environment variable configuration, install path C: \ Program Files (x86) \ Calibre2 can be arranged in the path.

 


Original link: https: //blog.csdn.net/june_young_fan/article/details/88628096

https://bitbucket.org/ariya/phantomjs/downloads/ download phantomjs:

Guess you like

Origin www.cnblogs.com/vole/p/12498528.html