Search code examples
javascriptwkhtmltopdf

wkhtmltopdf TimeOut Error


I have a node application which allows users to create PDFs from HTML.

The application uses wkhtmltopdf 0.12.3-dev-79ff51e (with patched qt) via node-wkhtmltopdf.

Sometimes I get the error:

Error: Exit with code 1 due to network error: TimeoutError
at Socket.<anonymous> (/srv/exporter/utils/wkhtmltopdf.js:117:19)
at Socket.g (events.js:260:16)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at Pipe.onread (net.js:523:20)

Why does wkhtmltopdf require network access?


Solution

  • Font Libraries which need to be downloaded during PDF creation.

    Some PDFs require font libraries and when WKHTMLTOPDF tried downloading those libraries the network connection timed out because of incorrect credentials.

    By coincidence some small PDFs did not require external fonts and the error was not present.