Search code examples
javascriptpythonpdfwkhtmltopdfpdfkit

wkhtmltopdf and pdfkit returning a blank pdf from url


I'm trying to create a pdf for easy reference of jobs on google careers however when I try to create a PDF using wkhtmltopdf I'm getting a blank page.

I believe this has something to do with the html of the page itself? When I try to inspect the page source the html code is very short. There's also a few javascript links.

The URL I'm trying is this one

And here's the code I'm using:

pdfkit.from_url("https://careers.google.com/jobs/results/125555613246595782-partner-engineer-google-cloud/", 'test.pdf',
           options={'--javascript-delay': 5000})

Using wkhtmltopdf like this also returns a blank pdf:

wkhtmltopdf https://careers.google.com/jobs/results/125555613246595782-partner-engineer-google-cloud/ test.pdf

Solution

  • Google used client-side rendering for this page.
    This is an old link, but maybe it will be useful to you https://github.com/devongovett/node-wkhtmltopdf/issues/70