南强小屋 Design By 杰米
最近用python写了个html转换工具html2pdf.exe https://wwk.lanzouf.com/iSpV90fbtpqh ,代码如下:
[Asm] 纯文本查看 复制代码
工具依赖wkhtmltopdf,先从https://wkhtmltopdf.org/downloads.html 下载,然后将wkhtmltopdf.exe加入环境变量,直接运行html2pdf.exe,导出的pdf文件在pdf目录:

然后用这个pdf合并工具 https://wwn.lanzouf.com/irAGD089czyj 将所有pdf合成一个文件,比如我将莫言老师的所有文章合成了一个pdf文件,看文章方便多了:


[Asm] 纯文本查看 复制代码
def to_pdf(): import pdfkit htmls = [] for root, dirs, files in os.walk('.'): for name in files: if name.endswith(".html"): print(name) try: pdfkit.from_file(name, 'pdf/'+name.replace('.html', '')+'.pdf') except Exception as e: print(e)
工具依赖wkhtmltopdf,先从https://wkhtmltopdf.org/downloads.html 下载,然后将wkhtmltopdf.exe加入环境变量,直接运行html2pdf.exe,导出的pdf文件在pdf目录:

然后用这个pdf合并工具 https://wwn.lanzouf.com/irAGD089czyj 将所有pdf合成一个文件,比如我将莫言老师的所有文章合成了一个pdf文件,看文章方便多了:


南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米
暂无批量将下载的公众号文章html转pdf,合并pdf文件的评论...