您当前的位置: 首页 >  Python
  • 1浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

一个处女座的程序猿 发布时间:2018-04-12 09:40:33 ,浏览量:1

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

 

 

目录

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)


 

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.0671s