Introduction
The purpose of this document is to find an alternative to generate online reports with client-side technologies like HTML, JavaScript, and CSS.
Pre-requisite
Node.js to run jsreport Server. (Follow the below steps to install node.js Server)
The only prerequisite to run jsreport server is node.js on target machine. The installation is initiated using npm. Follow the below guidelines to generate PDF report using jsreport server.
- Installing Node.JS Server and jsreport
- Reporting with browser-client
- Install js latest version on target machine. (https://nodejs.org/en/)(Download the latest version i.e. currently v7.10.0 Current). This will install a *.msi file . Follow the installation steps to install the package. (The approximate file size is 13 MB)
- Create a folder with any name in D: drive. (Which is an installation folder for jsreport).(E.g. jsreportServer)
- Open Node.JS command prompt in administrator mode and set the above folder as shown below to install jsreport software.

- Run the following command in command prompt (this may take some time to install the required files)npm install jsreport-cli –g

- After successful installation, please run the following command to initialize jsreport serverjsreport initAfter initialization completes, the command prompt looks like below.



- Now you can start your jsreport server locally with the following command and should see the second screen shot
jsreport start


- By default, the jsreport server runs on port 5488. We can change the port by modifying the configuration file in root folder (e.g. D:\jsreportServer)
- If we are running the server in development mode, we need to update the port in config.json file.
- If we are running the server in production mode update the port in config.json file.
- We can check the running jsreport server on target machine using http://localhost:5488.

Reporting with browser-client
- Create a new template in jsreport server by,
- Clicking on “templates +” in the above screen and name it “Employee” as shown in the below screen.

- Open the created template and copy the below code in it.

- If you want to add some styling to the template, you can add the CSS file in “assets +” and refer the styles in the template created above.
- You have to set the properties for the new template to recipe “phantom-pdf”

- Now, click “Save / Save All” button to save the data
- Clicking on “templates +” in the above screen and name it “Employee” as shown in the below screen.
- Now open Visual Studio or any editor to create a sample web application.
- Create a file with the name “HTML” and add a placeholder to display the report in HTML page.
- <input type="button" title="test" onclick="generateReport();" value="Get PDF Report"/>
- <div id="placeholder" style="height:900px;"></div>


raman sharmaPosted Nov 11, 2019, 11:56 PM
This was helpful to me.Thanks you.
Thiruppathi RPosted May 24, 2017, 10:37 PM
NIce article.Thanks for sharing..