Skip to content

f-albuquerque/nodejs-pdf-service

Repository files navigation

nodejs-pdf-service

A simple Node.js PDF service built with RabbitMQ and jsPDF.


pdf-service

Get started

  1. Run the following command to create the necessary docker containers to run this project:
$ docker-compose up
  1. Create a file named .env in the root of the project with the variables defined in .env.example.

  2. Create a database called pdf and run the following command to run the migrations:

$ yarn migrate
  1. Install dependencies:
$ yarn install
  1. Start the service:
$ yarn start

You can also start the service in dev mode with hard reload:

$ yarn dev

Instructions

Main data JSON structure needed to generate a PDF:

{
  "id": "",           // uuid
  "logo": "",         // base64
  "header": "",       // string
  "description": "",  // string
  "items": []
}

Items property is and array of items which are defined below.

  • Table
{
  "type": "table",
  "header": "",       // string
  "description": "",  // string
  "fields": [],       // string[]
  "items": []         // related to fields (example below)
}

Example table item:

{
  "type": "table",
  "header": "Lorem ipsum",
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
  "fields": ["foo", "bar"],
  "items": [
    {
      "foo": "lorem",
      "bar": "ipsum"
    },
    {
      "foo": "dolor",
      "bar": "sit"
    }
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published