1

I have got a Dict from a .txt data, and I want to create a PDF file with this data.

How can I create it?

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
R.Aslan
  • 23
  • 1
  • 7

1 Answers1

2
pip install pdfkit

Also install wkhtmltopdf:

Debian/Ubuntu:

$ sudo apt-get install wkhtmltopdf

Then in your code:

import pdfkit
import json
pdfkit.from_string(json.dumps(yourdict))

You could also do:

import pdfkit
pdfkit.from_file('your.txt', 'out.pdf')
alexisdevarennes
  • 5,437
  • 4
  • 24
  • 38