How to generate pixel perfect pdf documents using nodejs and jasper report?

I needed a way to produce dynamic pdf documents and reports from my nodejs backend server.

We can categorize solutions into 4 main category, this depends on how you design your document:

# Category Desc
1 html based document design your document using html and then use tools to render and convert html page to pdf. Such tools are:
- html-pdf (145k weekly npm downloads)
- html-to-pdfmake (24k weekly npm downloads)
- pdf-creator-node (10k weekly npm downloads)
- htmltopdf (less than 1k npm downloads)
- html-to-pdf (less than 1k npm doanloads)
- phantomjs headless
2 Microsoft word Using Microsoft word you can design your template document, generate final word document and then produce pdf from it.
- docxtemplater (41k npm downloads)
3 javascript code In this category, you can design your template using code with specific semantics then produce pdf documents from it.
- pdfmake (618K weekly npm downloads)
4 jasper report studio using Jaspersoft studio you can design you report. Then you can compile it using command line tools and generate pdf documents for your consumption.
- jasper studio and jasper report

I had some success with category 4 using jasper way of designing documents and producing reports.

In next tutorials I will explain more details on how to use jasper reports to design and produce pdf documents.