npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-jasperst

v1.0.2

Published

JasperReports for nodejs with JasperStarter

Downloads

9

Readme

Node-JasperSt

Based on PHPJasper Lib

A NodeJS Report Generator

About

Node-JasperSt is the best solution to compile and process JasperReports (.jrxml & .jasper files) just using nodejs, in short: to generate reports using nodejs.

Why Node-JasperSt?

Did you ever had to create a good looking Invoice with a lot of fields for your great web app?

I had to, and the solutions out there were not perfect. Generating HTML + CSS to make a PDF? That doesn't make any sense! :)

Then I found JasperReports the best open source solution for reporting.

What can I do with this?

Well, everything. JasperReports is a powerful tool for reporting and BI.

From their website:

The JasperReports Library is the world's most popular open source reporting engine. It is entirely written in Java and it is able to use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed or exported in a variety of document formats including HTML, PDF, Excel, OpenOffice and Word.

It is recommended using Jaspersoft Studio to build your reports, connect it to your datasource (ex: MySQL, POSTGRES), loop thru the results and output it to PDF, XLS, DOC, RTF, ODF, etc.

Some examples of what you can do:

  • Invoices
  • Reports
  • Listings

Requirements

  • NodeJS 14 or above
  • Java JDK 1.8

Optional

Installation

Just run:

npm install node-jasperst

You should have installed dotenv for config Java Runtime Enviroment 8 (JRE) path

npm install dotenv

Examples

  • in src/demo.ts you can see some examples:
import { NodeJasperSt } from 'node-jasperst'
import * as dotenv from 'dotenv'
import path from 'path';
dotenv.config()

enum reports {
  Hello = "examples/hello_world.jrxml",
  Contactos = "examples/json.jrxml",
}

enum data {
  Contactos = 'contacts.json',
}

const output = 'output';

async function compileJasper(njst: NodeJasperSt) {
  await njst.compile(reports.Contactos, output);
  result = await njst.execute()
  console.log(result)
}

async function processJasper(njst: NodeJasperSt) {
  let result = ''
  njst.process(reports.Contactos, output, {
    db_connection: {
      'driver': 'json',
      'data_file': path.join('examples', data.Contactos), 
    }
  });
  
  result = await njst.execute()
  console.log(result)
}

async function init() {
  const njst = new NodeJasperSt()
  await compileJasper(njst);
  await processJasper(njst);
}
init();
  • for more examples, please see PHPJasper README.md Examples.