Forum Archive

pdfkit PermissionError

uj_jonas

I wanted to convert HTML to PDF and looked it on Google. I found the pdfkit docs, but when I tried using it

import pdfkit

pdfkit.from_url('https://google.com', sys.argv[0][:-7] + 'out.pdf')

I got a PermissionError

My guess is it's just iOS restricting me, but I'd like to know if I'm doing something wrong.

dgelessus

It seems that pdfkit uses a separately installed command-line tool to do the actual conversion. iOS doesn't allow apps to start other processes, which is why you get a PermissionError. And even if you could, the necessary program wouldn't be installed.

uj_jonas

Aww :/

Well thanks for answering

Phuket2

@uj_jonas , not sure , this post may help you though

abcabc

You can use reportlab module (no need to install, already included) to create pdf files. May be you can look at this tutorial to create simple pdf documents.

http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

For converting html to pdf , you may install xhtml2pdf package.

omz

In Python 2 mode, the xhtml2pdf module is already included.

Yaroslav_Ya

@omz but is there same package for Python 3 mode?