PDF Generation Service
Overview
The objective of PDF generation service is to bulk generate pdf as per requirement.
Pre-requisites
Before you proceed with the documentation, make sure the following pre-requisites are met -
Install npm.
Kafka server is up and running.
egov-persister service is running and has pdf generation persister config path added in it.
PSQL server is running and database is created to store filestore id and job id of generated pdf.
Key Functionalities
Provide common framework to generate PDF.
Provide flexibility to customise the PDF as per the requirement.
Provide functionality to add an image, Qr Code in PDF.
Provide functionality to generate pdf in bulk.
Provide functionality to specify maximum number of records to be written in one PDF.
Environment Variables | Description |
| Maximum number of records to be written in one PDF |
| Date timezone which will be use to convert epoch timestamp into date ( |
| Default value of localisation locale |
| Default value of localisation tenant |
| File path/URL'S of data config |
| File path/URL'S of format config |
External Libraries used :
PDFMake: (https://github.com/bpampuch/pdfmake ):- for generating PDFs
Mustache.js: (https://github.com/janl/mustache.js/ ):- as templating engine to populate format as defined in format config, from request json based on mappings defined in data config
Interaction Diagram
Deployment Details
Create data config and format config for a PDF according to product requirement.
Add data config and format config files in PDF configuration
Add the file path of data and format config in environment yml file
Deploy latest version of pdf-service in particular environment.
Configuration Details
For Configuration details please refer to the Customizing PDF Receipts & Certificates document in Reference Docs
Integration
Integration Scope
The PDF configuration can be used by any module which need to show particular information in PDF format that can be print/downloaded by user.
Integration Benefits
Functionality to generate PDFs in bulk.
Avoid regeneration.
Support QR codes and Images.
Functionality to specify maximum number of records to be written in one PDF.
Uploading generated PDF to filestore and return filestore id for easy access.
Steps to Integration
To download and print the required PDF
_create
API has to be called with required key
(For Integration with UI, please refer to the links in Reference Docs)
Reference Docs
Doc Links
Title | Link |
Customizing PDF Receipts & Certificates | |
Steps for Integration of PDF in UI for download and print PDF | |
API Swagger Documentation |
API List
Title | Link |
pdf-service/v1/_create | |
pdf-service/v1/_createnosave | |
pdf-service/v1/_search |
(Note: All the API’s are in the same postman collection therefore same link is added in each row)