Skip to content
  • There are no suggestions because the search field is empty.

Utils

This page explains how to generate PDFs from templates and retrieve holiday dates using API endpoints.

PDF Generation

Vince Live offers a PDF generation API endpoint that can be used to create PDF files.

The endpoint uses PDFme as engine.

Creating a template

Use PDFme’s template editor to generate a layout. Set relevant field names for your fields!

When you are done with your template, use the DL Template button to download a JSON template. (This can be opened and edited again in the template editor.)

Generating the PDF

Available input properties

Property Mandatory Default Type Comment
template Yes N/A body parameter Template object downloaded from PDFme template editor
inputs Yes N/A body parameter Inputs to use for specific fields.

Example request

Note that the property names in inputs array will depend on your template configuration.

V1 API

POST /v1/utils/generate-pdf

{
"template": { /* template copied from file */ },
"inputs": [
{
"tableData": [
["Row 1 Col 1", "Row 1 Col 2", "Row 1 Col 3" ],
["Row 2 Col 1", "Row 2 Col 2", "Row 2 Col 3" ]
],
"invoiceNumber": "ABC34567890",
"logo": "data:image/png;base64,iVBORw0KGgoAAA..."
}
]
}

V2 API

POST /v2/utils/generate/pdf

{
"template": {},
"inputs": [
{
"tableData": [
[
"Row 1 Col 1",
"Row 1 Col 2",
"Row 1 Col 3"
],
[
"Row 2 Col 1",
"Row 2 Col 2",
"Row 2 Col 3"
]
],
"invoiceNumber": "ABC34567890",
"logo": "data:image/png;base64,iVBORw0KGgoAAA..."
}
]
}

<aside> <img src="/icons/warning_yellow.svg" alt="/icons/warning_yellow.svg" width="40px" />

For tables, note that you need to provide an array of arrays as input.

</aside>

Example result

Holidays

Used to get holidays and other dates of interest for a specific country, state and year.

Util is based on date-holidays NPM package

Get holidays

Available input properties

Property Mandatory Default Type Comment
country Yes N/A query parameter Country code
state No N/A query parameter State or province
year No Current year query parameter Calendar year

Example request

GET /v1/utils/holidays?country=no

// response
{
"count": 24,
"items": [
{
"date": "2023-01-01 00:00:00",
"start": "2022-12-31T23:00:00.000Z",
"end": "2023-01-01T23:00:00.000Z",
"name": "Første nyttårsdag",
"type": "public",
"rule": "01-01"
},
{
"date": "2023-02-12 00:00:00",
"start": "2023-02-11T23:00:00.000Z",
"end": "2023-02-12T23:00:00.000Z",
"name": "Morsdag",
"type": "observance",
"rule": "2nd sunday in February"
},
...
}