Public Repository

Last pushed: 4 months ago
Short Description
Wkhtmltopdf convertor wrapped into NodeJS service with minimal set status pages
Full Description

PDF Generator - Wkhtmltopdf in a Docker image

The docker image is Ubuntu 16.04 LTS, as the best compatible one. The size of the image: 353MB.

Includes logging into logstash with input: tcp { codec => "json" data_timeout => 10 port => 5001 type => "json-tcp-input"}

Not based on Alpine linux because:

  • Alpine requires virtual framebuffer for wkhtmltopdf to work
  • xvfb depends on hundreds of packages, including GTK, which produced 530MB image

The supported environment variables are:

  • PORT (default is 5580)
  • LOGSTASHHOST
  • LOGSTASHPORT

If LOGSTASHHOST and LOGSTASHPORT specified additional log apprender is created and pointed to that location. The logstash input type is TCP and the codec is JSON.

For API reference see swagger.yaml file or the index.hml of the running service (http://<host:5580>/)

NOTE: The logs are located at /var/log/pdf-generator/

Main usage scenario is using POST request with a JSON:

{
    "body":"1234567890......", //(base64 of the html)
    "options":{"prop":"value", "prop2":"value2" }, // https://wkhtmltopdf.org/usage/wkhtmltopdf.txt
    "header":"ABCDEF.....", //(base64 of the header html)
    "footer":"0987654.....", //(base64 of the footer html)
}

The service is working on [Node.JS] and [Express]. The useful additions are:

  • The status page on (http://<host:5580>/status)
  • The uptime page (http://<host:5580>/uptime)
Docker Pull Command
Owner
insightsoftware