Questions tagged [python-pdfkit]
84 questions
2
votes
2 answers
Image file can't covert to pdf when using python-pdfkit
Here is my code
options = {
"enable-local-file-access": True,
...
}
pdfkit.from_string(html_file, pdf_file, options=options, ...)
since Im using Django template, here is my code to reference that

Dan
- 21
- 8
2
votes
1 answer
Create a PDF and send as attachment with flask-mail
I am trying to create a PDF from an HTML page using pdf-kit, then send that pdf as an attachment in an email.
Here is my code to create the pdf, this seems to be working:
html = render_template("office_report.html",role=role,…

jesseCampeez
- 97
- 10
2
votes
2 answers
How to make pdfkit (and wkhtmltopdf) work on Google Colab?
I'm using pdfkit with jupyter notebook on windows 10 without problem.
Now I need to use it on Google Colab and don't even know where to start.
I tried installing the linux package into the "/users/contents"
! wget…
user14333141
2
votes
0 answers
Pdfkit python css not working as expected on aws ec2 server
I am using pdfkit python 0.6.1 with wkhtmltopdf 0.12.4 on both my local system and on ec2 server
The Problem is everything is running as expected on local system but on aws css styling got changed
Here is the template code
…

Karan Goyal
- 447
- 5
- 10
2
votes
0 answers
Flask Pdfkit- Unable to add custom font
I'm trying to include my custom font, but I'm getting the following error indicating that the font is not found. However, I can confirm that I'm correctly pointing to the font directory.
OSError: wkhtmltopdf reported an error:
Loading pages (1/6)
[>…

James Lannister
- 21
- 2
2
votes
1 answer
how to set page size when converting html to pdf in python pdfkit
I am trying to convert some local html files to pdf. These should be in a format that is easy to read on mobile. As such, I want to set a custom pdf size, so that I can fit the contents on one long and narrow pdf. The documentation on creating a new…

Ullsokk
- 697
- 2
- 11
- 24
2
votes
1 answer
convert image in base64 in flask to Adding in PDF
i am going to add image in pdf file using flask. when i add img tag in my html code, it won't appear. how can i add image in my pdf?
i found something like to convert in base64, but i don't know how to do it in python.
below is my flask route…

Hamza Awan
- 99
- 1
- 3
- 9
2
votes
2 answers
ImportError: No module named pdfkit
I am working on pdfkit library in python in order to create pdf file from html string. It works fine on my linux system but when i try to run it on windows server then it gives me error
pdfkit.from_string(html_string, output_dir)
and i get…

Ancient
- 3,007
- 14
- 55
- 104
2
votes
1 answer
Wkhtmltopdf (pdfkit) - QXcbConnection: Could not connect to display
I'm working on a Django project where we generate PDF files from HTML template. I use django-pdfkit to render PDF.
On my Ubuntu 16.04 everything works correctly but when I deploy the project on DigitalOcean Ubuntu 16.04 server, it raises…

Milano
- 18,048
- 37
- 153
- 353
2
votes
1 answer
How to display a footer line above the footer using the pdfkit library in python?
Background Info
I have the following Python code that I want to use to generate a pdf file. It uses the pdfkit library.
import pdfkit # import python module
if __name__=="__main__":
options = {
'page-size':…

Ebrahim Karam
- 841
- 1
- 11
- 22
2
votes
1 answer
how to add dynamically generated pdf file to zipfile Python?
z = zipfile.ZipFile("zipfile.zip", "w")
z.write(filename)
It takes string as an argument that is actually path of that file to be add to the zip.
But I want to add dynamically generated file.

Bhirendra Kumar Sahu
- 101
- 1
- 9
2
votes
1 answer
Python pass request headers to pdfkit
I am trying to convert a URL to pdf using pdfkit in python as follows.
import pdfkit
pdfkit.from_url(url, file_path)
I wanted to know is there some way to pass custom request headers with this URL such as X-Proxy-REMOTE-USER to something.

station
- 6,715
- 14
- 55
- 89
1
vote
0 answers
Rendering Konva.js script to image in python
While generating a pdf in python using pdfkit, I am required to attach a diagram drawn using konva.js script to the pdf. I have attached the konva.js script to the html code string but the image is not being rendered into the pdf while generating.…

Sanju biju varghese
- 11
- 1
1
vote
0 answers
Passing Kerberos Credentials in PDFKIT python pdf generator tool
I have a URL which requires Kerberos Credentials (single sign on) for Authentication. I need to generate PDF of this URL response webpage. but when i am trying using pdfkit i am getting authentication error. Can anyone please provide the necessary…

sorabh jain
- 11
- 1
1
vote
1 answer
Convert html table into pdf using flask
I'm tried to solve the following problem using pdfkit.
when I add wkhtmltopdf configuration to my app then my app can't load into the browser even the index page cant load into the browser. but when I remove wkhtmltopdf configuration from my app…

ijaz Bacha
- 49
- 8