Python generates PDF data through pdfkit

tags: python  pdf

wkhtmltopdf download address

# -*- coding:utf-8 -*-
import pdfkit


path_wk = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' # Change to the location where you installed it
config = pdfkit.configuration(wkhtmltopdf=path_wk)
 pdfkit.from_string("string",'jmeter_download file1.pdf', configuration=config) # string
 # pdfkit.from_url("www.baidu.com",'jmeter_download file 2.pdf', configuration=config) # website link
 # pdfkit.from_file("./file name.html",'jmeter_download file 3.pdf', configuration=config) # file name is best not to use Chinese

Remember to install pdfkit pip install pdfkit

Pay attention to the garbled characters in the following figure, it must be the following three wrong methods

pdfkit.from_string
pdfkit.from_url
pdfkit.from_file

 

operation result

 

Intelligent Recommendation

pdfkit | Convert html files to pdf using python

When writing code documents in jupyter notebook, sometimes you need to export the pdf version, but jupyter will report an error. I was thinking that apart from the online debug method, there is no oth...

Python-Web Page PDF Toolkit Pdfkit

Pdfkit (https://pypi.org/project/pdfkit/ ) Python 2 and 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.   Install: PIP Install Pdfkit is installed ( )。   Note: The too...

PDFKIT deployment (export Python plugin for PDF)

1, PDFKIT installation 2, Python uses PDFKIT, call pdfkit.from_string, etc., the following error will occur. And if you use PIP InstallwkhtmltopdfThis problem occurs if it is installed. 3, download th...

Python Pdfkit Tool: HTML is converted into PDF

Summary: Summary: Cottage processing: Flask client uploads files, read the FileStorage stream object, transform the stream object into string type, convert HTML content into a PDF file via the PDFKIT ...

Python package-PDFKIT (WKHTMLTOPDF) converts HTML to PDF

Articles directory Python package-PDFKIT converts HTML to PDF What is pdfkit Install use Generate URL PDF file String generates pdf [pdfkit.from_string () function] Report an error Error oserror: no w...

More Recommendation

SwiftUI PDFKit displays PDF files through button control

The value and gains of this article After reading this article, you will be able to make the following interface [email protected] Jietu20200510-110903.gif Basic knowledge (master can skip, ...

pdfkit||Summary of the method of converting web pages to PDF using python

Python's third-party library pdfkit can generate pdf files from web pages, html files and strings. Install related dependencies 1.python version 3.x, type in the command linepip install pdfkit 2. Inst...

Python converts web pages to PDF artifacts PDFKIT library using __

Article catalog Foreword First look at the results map First, install the necessary software Second, open code Introduced 2. Guide 3. Worse website 4. Create an object HTP 5. Get link Idea: 6. Get the...

Python notes use the PDFKIT module to generate PDF (in the middle with HTML)

PDFKIT module installation example 1: run Code Example 2 run Code...

PDF with Selenium, ChormeDriver and PDFKIT

principle: Using Selenium + Chromedriver opens the page, get the HTML source, then use PDFKIT to generate PDF   concept: Selenium: Selenium is a tool for web application testing. Selenium test is...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top