Skip to content

gibbon-lab/gibbon-pdf

Repository files navigation

Gibbon-pdf

Docker image: https://hub.docker.com/r/gibbonlab/gibbon-mail

Generate PDF with Template and JSON Schema.

Project status: POC

Screencast: https://www.youtube.com/watch?v=2M10x76f6c8

Requirement:

Why this project?

  • I would like to move PDF generation from my application in a separate service
  • I would like to allow humans to generate PDF manually, via a simple application plugged to the same API.
  • I would like to keep a history (optionally) of all document generated

Roadmaps

  • Integrate mozilla-services/react-jsonschema-form
  • Integrate puppeteer
  • Docker Image (harobed/poc-generate-pdf-with-html-template-and-jsonschema:latest)
  • curl example
  • Screencast
  • Add S3 upload option
  • Add UISchema support
  • Check json input with JSON Schema
  • Test frontend
  • Configure CI
  • Swagger
  • Add option to save generated pdf (in PostgreSQL)

Docker Image

gibbonlab/gibbon-pdf Docker Image is automatically builded with with our CI. We currently maintain several versions as we use semver to tag our docker images

  • latest tag is pushed with the last commit on master
  • vX.X.X tag are pushed when we push a new tag

To see how to create a new tag see "How to publish a new version"

Features

  • Generate PDF file from:
    • HTML template
    • Json field values (validated by JSON Schema)
  • Rest API endpoints to generate html preview or PDF
  • Web UI to generate PDF manually:
    • HTML form are autogenerated by JSON Schema
    • User can preview the document or generate the PDF
  • Optionnaly record all PDF generation

How does the multi-language support works?

Inside your pdf templates folders, you can create multiple languages files for the same pdf, in the following format: {lang}.html.

You also need to let a default file in case the language is not found or no language is requested.

So, for example, your folder should look something like this:

$ ls pdf-templates/pdf-example
default.html                         de.html              fr.html                                  es.html      

Then, you can add the lang property to the body or query params of your request, which will send the pdf with the requested language if it exists.

For example, the following body will try to send a german pdf:

{
    ...,
    "lang": "de"
}

If the lang property is not present in the body of your request, the default pdf will be sent.

This project is based on this stack

FAQ

How can I enable Authentication system?

This project hasn't build-in authentication system, it's a internal service in your stack, you must protect it by a private network or Basic access authentication system.

Why « Gibbon-pdf » name?

Gibbon as an allusion to Mandrill App.


Invoice examples:

Compare with other projects: