WkHtmlToX projects uses WebKit as a backend to virutally render a web page and execute its JavaScript to get the final page for printing.
The issue is that the version of WebKit used is very old and this makes debugging JS regressions difficult. WkHtmlToX does offer a way to output the console, but it gives no way to do active debugging and provides no line numbers!
To debug JavaScript using the same WebKit version, I tracked down the version of Chromium that uses a close enough webkit version that this library leverages (534.34). Chromium 13.0.767.1, which is available here as a standalone exe for windows.
If your page does not already have a handler for window.onerror
, add one with the following code in your page boot code.
// Detect old safari version used by QT and Chromium 13.0.767.1
if (naviagtor.userAgent.indexOf("Safari/534.3") > -1) {