HUB
Sign inSign up

insightsoftware/wkhtmltopdf

By insightsoftware

•Updated over 6 years ago

Wkhtmltopdf convertor wrapped into NodeJS service with minimal set status pages

Image
6

100K+

insightsoftware/wkhtmltopdf repository overview

⁠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:

Tag summary
Recent tags
Content type
Image
Digest
Size
205.4 MB
Last updated
over 6 years ago
docker pull insightsoftware/wkhtmltopdf:1.0.10-develop