1

Running on windows7, using wkhtmltopdf to generate a pdf from our site works fine from a command prompt. Running the exact same wkhtmltopdf command from a servlet running in jetty via commons-exec results in a blank pdf.

I've turned on the accesslog valve on our site as well as installed netmon on win7, and I can clearly see that the web request to our site itself is being generated when invoked from the command prompt, but isn't being generated at all from the jetty-launched process.

I've examined the event logs with Event Viewer on win7, but I don't see any security exceptions or such that might explain the empty pdf. The fact that it is generating a pdf implies that the wkhtmltopdf executable is being invoked correctly.

Any ideas what might be causing wkhtmltopdf to not have http access?

skaffman
  • 398,947
  • 96
  • 818
  • 769
JJFeiler
  • 61
  • 1
  • 4

1 Answers1

2

Solved it, in case anyone else runs across this: Though the wkhtmltopdf executable was running fine, it was being launched with no environment variables whatsoever, and that was causing the http request to fail silently (or at least in a way that I never discovered). Changing the process launcher to copy over all the env vars from the launching process into the wkhtmltopdf process solved the problem.

Note that I finally solved this by wrapping wkhtmltopdf in a bat script and printing out env vars and other state in there. Had to brush up on my bat scripting, but it was worth it.

JJFeiler
  • 61
  • 1
  • 4