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

网友投稿 905 2022-05-30

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

目录

pdfkit简介

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

pdfkit安装

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)

Python

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:华为云知识图谱服务--结构化数据实践(下)
下一篇:AR502H 二次开发日记
相关文章