• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    Dockerfile
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

如果你想使用 GitBook 生成 PDF ,又不想折腾,使用这个项目就对啦!

Docker Gitbook PDF Generator

如果你想使用 GitBook 生成 PDF ,又不想折腾,使用这个项目就对啦!

众所周知 GitBook 新版本调用 calibre 生成的 PDF 尺寸比较大,而且不支持 PDF 压缩,非常不利于传播。

经过简单的寻找,我看到 fuergaosi233 同学用 Python 基于 weastprint 编写了一个简单的 GitBook PDF 生成工具,使用下来发觉还不错,于是就封装了这个镜像,希望能够帮助到有同样需求的你。

使用方法

如果你生成的电子书包含中文,那么在使用之前,你需要准备至少一个字体文件,比如 苹方思源等,将文件保存在你当前目录的 fonts 文件夹内。

然后直接使用 DockerHub 官方自动构建的容器镜像,配合文件挂载参数使用即可。

比如我们要将 http://self-publishing.ebookchain.org 的内容生成为电子书,只需要执行下面的命令:

docker run --rm -v `pwd`/fonts:/usr/share/fonts \
                -v `pwd`/output:/app/output \
                soulteary/docker-gitbook-pdf-generator:1.0.0 "http://self-publishing.ebookchain.org"

如果你是 Windows 用户,使用 Powershell,可以使用下面的命令:

docker run --rm -v $PWD/fonts:/usr/share/fonts \
                -v $PWD/output:/app/output \
                soulteary/docker-gitbook-pdf-generator:1.0.0 "http://self-publishing.ebookchain.org"

稍等片刻,你将会看到下面的内容:

crawl : all done!
Generating pdf,please wait patiently
Generated

这时,你当前目录会自动多出一个名为 output 的新目录,而电子书就会安静的躺在里面啦。

如果你觉得上面这条命令太过复杂,也可以使用仓库中的 docker-compose.yml 模版来进行电子书生成操作,如果你不太会使用,可以围观我博客中 docker 相关的使用教程,通常阅读时间都在十分钟左右, Good Luck。

其他

如果你对样式有更高的要求,可以使用文件挂载的方式修改 /app/gitbook.css 的样式。

如果你想了解更多细节,可以阅读 这篇博客

常见问题

  • 运行报错
    • 报错提示 “/usr/local/lib/python3.7/site-packages/weasyprint/fonts.py:230: UserWarning: FontConfig: No fonts configured. Expect ugly output. 'FontConfig: No fonts configured. ”
    • 报错原因 字体挂载位置不正确,请参考最新文档中的命令。感谢 ISSUE 里诸位网友反馈。
  • Windows 环境命令报错
    • 报错提示 “Error response from daemon: create pwd/fonts: "pwd/fonts" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.”
    • 报错原因 windows 不支持 bash 标准语法,使用
  • 生成 PDF 中文显示不正确,显示为“口口”
    • 解决方法:下载或者拷贝系统字体到你要挂载的目录,再次执行程序

协议

MIT, For Everyone.

More Repositories

1

tenant-point

租房要点,适用于北上广深杭,欢迎补充。
1,597
star
2

docker-flare

Flare ✨ Lightweight, high performance and fast self-hosted navigation pages, resource utilization rate is <1% CPU, MEM <30 M, Docker Image < 10M
1,105
star
3

docker-prompt-generator

Using a Model to generate prompts for Model applications. / 使用模型来生成作图咒语的偷懒工具,支持 MidJourney、Stable Diffusion 等。
Python
1,002
star
4

Home-Network-Note

🚧 持续更新 🚧 记录搭建兼顾学习娱乐的家用网络环境的过程,折腾过的一些软硬件小经验。
Ruby
971
star
5

forever-coolshell

酷壳 - CoolShell 电子存档,🕯️ 谨纪念和保存陈皓先生的公开的技术分享内容,感恩皓叔对中文互联网,尤其是技术领域无私的分享。
HTML
750
star
6

docker-llama2-chat

Play LLaMA2 (official / 中文版 / INT4 / llama2.cpp) Together! ONLY 3 STEPS! ( non GPU / 5GB vRAM / 8~14GB vRAM)
Python
368
star
7

docker-outline

A simple 🧑‍💻 and reliable self-hosted plan for Outline.
Shell
121
star
8

docker-sso-server

Lightweight 🪶 self-hosted SSO server, resource utilization rate is <1% CPU, MEM <15 M
Shell
114
star
9

flare

🏂 Challenge all bookmarking apps and websites directories, Aim to Be a best performance monster.
Go
104
star
10

jquery-city-select

一个简单的jQuery省市联动插件,支持AMD/CMD方式调用,当然,也支持直接引用。
JavaScript
102
star
11

certs-maker

Tiny self-signed tool, file size between 1.5MB(binary) and 4MB (docker). Generate a self-hosted / dev certificate through configuration.
Go
96
star
12

docker-flame

简洁美观的个人启动页,适用于 HomeLab 爱好者的中文化的自部署版本。
86
star
13

Get-D2-2014-Ticket

Get D2 2014 Ticket - Designer & Developer Frontend Technology Forum
JavaScript
81
star
14

docker-cronicle

Simple, lightweight, beautiful webui Cronjob / Scheduled task docker solution.
JavaScript
79
star
15

docker-stable-diffusion-taiyi

带 Web UI 的 Docker taiyi (太乙),中文 Stable Diffusion WebUI 一键运行环境。
Dockerfile
76
star
16

sparrow

ChatGPT Style client-compatible Backend Server, open source implementation.
Go
74
star
17

docker-chatgpt

< 10MB, One-click self-hosted ChatGPT, allowing access to various data sources and non-OpenAI models.
70
star
18

njs-learning-materials

List some learning materials to help you step into the world of njs.
56
star
19

traefik-example

Traefik 快速上手示例
Shell
53
star
20

wordpress-for-sae

WordPress For SAE 3.9已更新.
PHP
52
star
21

docker-code-interpreter

One-click Docker APPs of Open-source Code Interpreter Projects.
Shell
39
star
22

generator-lazy

一个要努力成为机智✨的脚手架的工具🔧,给你的项目一个好的开始。
JavaScript
38
star
23

rss-can

🚀 Harness the power of AI, Got RSS CAN be better and simple.
Go
33
star
24

AvatarCache

Your Own Avatar Api.
PHP
32
star
25

docker-sdxl

简单、靠谱的 SDXL Docker 使用方案。
Python
26
star
26

easy-ESXi-builder

Still having trouble building environments for ESXi? Just use this one-click tool.
Dockerfile
24
star
27

portable-docker-app

🎩 Magic in Pocket / 🪄 口袋里的“魔法”.
Python
24
star
28

lorenote

A knowledge note tool/solution that combines engineering and AI.
21
star
29

nginx-formatter

Small and easy-to-use Nginx configuration formatting tool (CLI & GUI), support Docker, x86, ARM, macOS...
Go
21
star
30

docker-gfpgan

TencentARC GFPGAN ALL-IN-ONE Docker Images. support x86 / ARM.
Dockerfile
19
star
31

docker-njs

Pure njs(Nginx JavaScript) Docker image, more convenient for development and debugging.
Shell
19
star
32

docker-nginx-forward-proxy

For Centrally manage application export traffic, A/B testing, etc. Perhaps the smallest nginx forward proxy server docker images.
Dockerfile
19
star
33

remote-hosts-server

Tiny(~5MB), Easy, Docker Support. Manage and share your Hosts configuration, suitable for tools such as Switch Hosts.
JavaScript
17
star
34

prebuilt-nginx-modules

A bunch of useful pre-built modules for nginx, can be used directly in docker or Debian/Ubuntu.
16
star
35

have-fun-with-AnimeGAN

Have fun with the model: AnimeGAN
Python
16
star
36

docker-wechat-markdown-editor

开箱即食的微信编辑器。(容器镜像大约6M)
JavaScript
15
star
37

ubuntu-remote-control-helper

Make Ubuntu Native Remote Control Easy to use and Reliable.
Go
15
star
38

nginx-qrcode-server

High Performance QR Code Server with Nginx, Close to the size of the official Nginx Docker Image (~ 55MB).
Dockerfile
12
star
39

traefik-aria2-with-webui

Aria2 with WebUI and Traefik.
JavaScript
11
star
40

autoindex

A simple & neat AutoIndex website template for Nginx.
JavaScript
11
star
41

docker-pytorch-playground

Running models faster and easier, support for x86 and ARM (M1, M1Pro).
Dockerfile
11
star
42

ngx-php-micro-blog

Microlog example based on Nginx and Nginx module (NGX-PHP8), A high-performance implementation that does not use the combination of Nginx and PHP-FPM, which is safe and reliable.
PHP
9
star
43

firephp-for-chrome-sae

FirePhp For Chrome
JavaScript
9
star
44

docker-nomnoml

Docker Nomnoml is a simple but elegant self-hosted UML Generator & UML Sharing solution.
Dockerfile
9
star
45

china-university-icon

中国大学校徽
JavaScript
9
star
46

debug.js

Let browser debug better.
JavaScript
9
star
47

Replace-Google-Fonts

Use Qihoo 360 Open Fonts Service to replace Google's.
PHP
8
star
48

wp2md

Convert WordPress Posts to markdown files. / 将WordPress文章转换为md文件。
JavaScript
8
star
49

youling

Ghost CJK Version. 既然官方不喜欢非英文用户,那么就不提PR了,顺便用换个非英文名好了。
JavaScript
8
star
50

zheteng-it

📒持续更新📒 开源的折腾笔记,分享一些尚未写成博客的内容。
HTML
6
star
51

docker-codeformer

快速体验 & 上手 CodeFormer,2G 显存可以玩。
Python
5
star
52

mini-shortener

Zero dependency, configuration-based, short link service with less than 200 lines.
Go
5
star
53

redirect-test

Redirect performance test.
Java
5
star
54

linux-scripts

Store some useful small scripts.
Shell
5
star
55

open-ai-camera

本地隐私优先的,AI 人像相机解决方案,基于 Docker 和 Stable Diffusion。
4
star
56

hosts-blackhole

BEST hosts list processing helper for ad-blocking/blocker programs: AdGuard, AdAway, blocky, grimd...
HTML
4
star
57

tech-radar-demo

A simple technical radar implementation
HTML
4
star
58

ghost-aliyun-oss-store

Ghost v3.x use Aliyun OSS storage.
JavaScript
4
star
59

You-Dont-Need-Webpack

HTML
4
star
60

funny-china-weather

开箱即用的天气软件包,获取基础的天气信息,以及对应天气的动态图标。
Go
4
star
61

simple-i18N

适用于单页面的i18N脚本。
CSS
4
star
62

which-mi-phone-should-buy-for-flashing

哪块小米/红米手机买来刷机合适呢?/ Which Mi Phone should buy for flashing?
4
star
63

soulteary

4
star
64

gitlab-variable-helper

Allow use configuration file update gitlab group variables.
JavaScript
4
star
65

docker-emotion

Out-of-the-box text emotion / sentiment analysis application, supports Chinese and English.
JavaScript
4
star
66

decode-your-qrcode

《使用 Docker + Node 快速实现一个在线的QRCode解码服务》文章配套代码
HTML
3
star
67

phabricator-dockerize

Dockerfile
3
star
68

docker-milvus

[WIP] Reliable, highly scalable Milvus docker images
Dockerfile
3
star
69

localStorage-limit-test

Collect localStorage limit, improve client storage decisions.
CSS
3
star
70

nginx-rsa-encryption

Use NJS to implement RSA automatic encryption and decryption with API interface
JavaScript
3
star
71

electron-monitor

Retro Style Status Monitor Page.
2
star
72

awesome-golang-embed

WIP (Golang) Everything you ever wanted to know about static resource embedding
Go
2
star
73

Replace-Google-Libs

Use Qihoo 360 Open Libs Service to replace Google's.
PHP
2
star
74

Error-Tracer

简单的前端问题追踪程序,完善空间很大。
JavaScript
2
star
75

njs-ddns-service

Use NJS to implement DDNS service
JavaScript
2
star
76

emoji-extra

extra emoji for meituan im.
JavaScript
2
star
77

generator-lazy-demo

Generator Lazy Demo.
CSS
2
star
78

CSS-Minimum-Support

一份简单的CSS支持度列表。
2
star
79

docker-fileserver

2
star
80

posts-adapter-pure-to-hugo

code highlight / post expect / archives features for pure markdown file.
JavaScript
2
star
81

tengine-website-generator

HTML
2
star
82

hugo-helper

存放一些能够让 Hugo 更好用的小工具,支持更加结构化的使用文章数据。
Go
2
star
83

text-retrieval-example

Let's talk about text retrieval.
Go
2
star
84

js-tasker

一个随便写的js tasker。
JavaScript
2
star
85

domain-dashboard

[wip]simple domain dashboard
JavaScript
2
star
86

docker-dokuwiki

Elegant docker environment, for DokuWiki.
Dockerfile
2
star
87

xStorage

Inspire by simpleStorage and jStorage (@andris9).
JavaScript
1
star
88

homelab-group

Just Waiting for the ICP process to end and update the content
1
star
89

url-param-parser.js

A simple function to Parse URL Params.
JavaScript
1
star
90

go-closure-compiler

JavaScript
1
star
91

offline-logs-to-clickhouse

Offline Logs Processing for ClickHouse.
Dockerfile
1
star
92

javascript-leetcode-playground

My JavaScript LeetCode Playground.
JavaScript
1
star
93

acm-fellows-api

API of ACM Fellows.
Go
1
star
94

serving-static-files

A plan about serving static files && deployed.
Lua
1
star
95

k8s-images-trans-helper

Shell
1
star
96

easy-asp-demo

帮同学写的一个简单的ASP程序,貌似是毕业设计。
ASP
1
star
97

easy-map-demo

为凌霄同学写的DEMO,基于Story/Qing+Bootstrap。
PHP
1
star
98

DemoAuthenticator

A simple demo authenticator chrome ext.
HTML
1
star
99

docker

🐳
Dockerfile
1
star
100

scroll-joke

Endless rolling.
JavaScript
1
star