打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Py之pdfkit:python的库之pdfkit简介、安装、使用方法详细攻略

Py之pdfkit:python的库之pdfkit简介、安装、使用方法详细攻略


pdfkit简介

     pdfkit,把HTML+CSS格式的文件转换成PDF格式文档的一种工具。它就是html转成pdf工具包wkhtmltopdf的Python封装。所以,必须手动安装wkhtmltopdf。

pdfkit安装

pip install pdfkit

pdfkit使用方法

import pdfkit

pdfkit.from_url('http://google.com', 'out.pdf')
pdfkit.from_file('test.html', 'out.pdf')
pdfkit.from_string('Hello!', 'out.pdf')

pdfkit.from_url(['google.com', 'yandex.ru', 'engadget.com'], 'out.pdf')
pdfkit.from_file(['file1.html', 'file2.html'], 'out.pdf')


with open('file.html') as f:
    pdfkit.from_file(f, 'out.pdf')


# Use False instead of output path to save pdf to a variable
pdf = pdfkit.from_url('http://google.com', False)


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
爬虫实战【3】Python
Python批量转换HTML为PDF | Medivh's castle
是程序员,就用python导出pdf
用 Python 将 html 转为 pdf、word
竟然可以用 Python 抓取公号文章保存成 PDF
Python爬虫实现的微信公众号文章下载器
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服