7

I'm trying to render a pdf of a html page. In the end of the HTML I have a very short jQuery script.

After wkhtmltopdf has been executed, it renders all the HTML fine however the Javascript has not been loaded for the PDF file. So it seems as if either wkhtmltopdf is ignoring my Javascript, or it is generating the .pdf before it is running the javascript.

I've tried both with $(document).ready and without, without results. I've tried --debug-javascript without any information retrieved.

Any ideas?

2
  • Try using --javscript-delay More information madalgo.au.dk/~jakobt/wkhtmltoxdoc/… Commented Jun 13, 2013 at 10:59
  • ./wkhtmltopdf-amd64 --javascript-delay 5000 --no-stop-slow-scripts --enable-javascript --debug-javascript http://www.domain.com/pdf/11/ ./srv/www/domain/mycard1.pdf Without any results. No debugging information and Javascript has not been loaded during creating the pdf. Commented Jun 13, 2013 at 12:34

1 Answer 1

12

SOLVED: I solved this issue by using pure Javascript instead of using jQuery. I tried loading jquery.min.js, normal jquery.js and also making sure it was on the same host as I was running wkhtmltopdf from. Nothing worked.

When I instead used normal javascript it was running fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.