Tags
python , PDF
Asked 7 years ago
21 Feb 2017
Views 2523
jessica

jessica posted

how to generate pdf file in Python ?

how to generate pdf file in Python ?
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

WeasyPrint

install WeasyPrint

pip install WeasyPrint


try out something :

from weasyprint import HTML
HTML('http://arrayoverflow.com/').write_pdf('/tmp/arrayoverflow-website.pdf')
Rasi

Rasi
answered Nov 30 '-1 00:00

pdfrw
pdfrw is a Python library and utility that reads and writes PDF files:

it generate result.pdf

from pdfrw import PdfWriter
 y = PdfWriter()
 y.addpage(x.pages[0])
y.write('result.pdf')
Mahesh Radadiya

Mahesh Radadiya
answered Nov 30 '-1 00:00

PyMuPDF
Python bindings for MuPDF's rendering library.
installation guide
Nilesh

Nilesh
answered Nov 30 '-1 00:00

python-pdfkit

Python-PDFKit: HTML to PDF wrapper

Install python-pdfkit:


pip install pdfkit



import pdfkit

pdfkit.from_url('http://arrayoverflow.com', 'out.pdf')
pdfkit.from_file('arrayoverflow.html', 'out.pdf')
pdfkit.from_string('Hello!', 'out.pdf')
Post Answer