Public Repository

Last pushed: 2 months ago
Short Description
Short description is empty for this repo.
Full Description

neopdf

neopdf is essentially wkhtmltopdf as a service.

Quickstart

As always just issue

$ docker-compose up

Afterwards neopdf is listening for requests on port 8080.

Usage

var data = JSON.stringify({
  "body": "<p>Lorem ipsum dolor sit amet.</p>",
  "header": "<!DOCTYPE HTML><h1 style=\"color: red\">Lorem ipsum</h1><hr/>",
  "footer": "<!DOCTYPE HTML><hr/><p>dolor sit amet.</p>",
  "options": [
    "--grayscale",
    "-T 30mm"
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://localhost:8080/");
xhr.setRequestHeader("authorization", "Bearer sup3rs3cr3t");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Config

Set the bearer token that clients need to provide by setting the environment variable BEARER_TOKEN.

Docker Pull Command
Owner
neoskop

Comments (0)