Py之pdfkit:python的库之pdfkit简介、安装、使用方法详细攻略
生活随笔
收集整理的這篇文章主要介紹了
Py之pdfkit:python的库之pdfkit简介、安装、使用方法详细攻略
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Py之pdfkit:python的庫之pdfkit簡介、安裝、使用方法詳細攻略
?
?
目錄
pdfkit簡介
pdfkit安裝
pdfkit使用方法
?
?
?
?
pdfkit簡介
? ? ?pdfkit,把HTML+CSS格式的文件轉(zhuǎn)換成PDF格式文檔的一種工具。它就是html轉(zhuǎn)成pdf工具包wkhtmltopdf的Python封裝。所以,必須手動安裝wkhtmltopdf。
?
?
pdfkit安裝
pip install pdfkit
?
pdfkit使用方法
import pdfkitpdfkit.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)?
《新程序員》:云原生和全面數(shù)字化實踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的Py之pdfkit:python的库之pdfkit简介、安装、使用方法详细攻略的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: wkhtmltopdf:wkhtmlto
- 下一篇: 成功解决ValueError: Inva