Skip to content

hailaz/doc2pdf

Repository files navigation

doc2pdf

将网页文档转换为单个 pdf 文件(带书签)。

支持文档类型

  • confluence
  • docusaurus

安装

go install github.com/hailaz/doc2pdf/cmd/doc2pdf@latest

使用

doc2pdf -h
# 示例
doc2pdf confluence --index="https://goframe.org/display/gf" --output="./output/temp"

环境准备

ubuntu 无界面环境

字体

中文字体
sudo apt update
sudo apt install ttf-wqy-zenhei
fc-cache -f -v

谷歌浏览器(选装)

sudo apt update
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt install ./google-chrome-stable_current_amd64.deb

原理

先使用rod控制浏览器,将网页转换为 pdf 文件。

然后使用unipdf将 pdf 文件合并,最后再将目录插入到合并后的 pdf 文件中。