安装 wkhtmltopdf

  • 使用 brew 进行安装

    1
    
    brew install --cask wkhtmltopdf
    

目录下所有 html 文件一键转换为 pdf 文件

1
for f in *.html; do wkhtmltopdf --load-error-handling ignore -n --enable-local-file-access  $f "$f.pdf"; done

参考文档