跳转到主要内容

BookStack 导出中文 PDF

第一步:安装 wkhtmltopdf

# 安装字体配置工具
yum install -y wget unzip fontconfig

# 中文香港(可选)
wget https://fonts.google.com/download?family=Noto%20Sans%20HK -O Noto_Sans_HK.zip
unzip Noto_Sans_HK.zip -d /usr/share/fonts
fc-cache

# 中文繁体(可选)
wget https://fonts.google.com/download?family=Noto%20Sans%20TC -O Noto_Sans_TC.zip
unzip Noto_Sans_TC.zip -d /usr/share/fonts
fc-cache

# 中文简体
wget https://fonts.google.com/download?family=Noto%20Sans%20SC -O Noto_Sans_SC.zip
unzip Noto_Sans_SC.zip -d /usr/share/fonts
fc-cache

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm -O wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm 

# /usr/local/bin/wkhtmltopdf
which wkhtmltopdf

第二步:配置 BookStack

WKHTMLTOPDF=/usr/local/bin/wkhtmltopdf
ALLOW_UNTRUSTED_SERVER_FETCHING=true