wkhtmltox.js: code de-duplication