0

I'm trying to render a webpage with pdfkit

My code:

import pdfkit
config = pdfkit.configuration(wkhtmltopdf='/Library/Python/2.7/site-packages/wkhtmltopdf/wkhtmltopdf')
pdfkit.from_string('http://stackoverflow.com', 'so.pdf', configuration=config)

But this just returns a blank pdf with the requested URL at the top.

When in terminal I run wkhtmltopdf directly...

wkhtmltopdf http://stackoverflow.com so2.pdf

It renders fine

What am I doing wrong?

Andie2302
  • 4,825
  • 4
  • 24
  • 43
Ben Mayo
  • 1,285
  • 2
  • 20
  • 37

1 Answers1

1

This works fine with me:

>>> import pdfkit
>>> pdfkit.from_url('http://stackoverflow.com', 'out.pdf')

What is your pdfkit and wkhtmltopdf version?

If your job is only calling one simple page, you can also do something like directly:

>>> import os
>>> os.system('wkhtmltopdf http://stackoverflow.com out.pdf')
Sait
  • 19,045
  • 18
  • 72
  • 99