table-json-to-jpeg
v1.0.5
Published
Converts JSON 2d array (array of rows, rows = array of cells) into jpeg of that table using node-canvas
Downloads
2
Readme
json-to-jpeg
This package allows you to convert a 2 dimensional JSON array into a jpeg image. Some potential uses:
- Including a table module for a text editor that doesn't support tables
- Displaying data to a user on your website
Soon, it will support converting csv and xsl files as well.
Installation
npm install table-json-to-jpeg --save
Note: Depends on Node Canvas which depends Cairo and Pango. Head over to that repo, and follow the quick instruction for the easy install based on your OS.
Usage
var data = [
['col1', 'col2', 'col3'],
['col1 row2', 'col2', 'col3'],
['col1 row3', 'col2', 'col3']
]
new TableToJpg(data).printImage("outfile.jpg").then(() => {
console.log("successfully created table")
})
.catch((e) => {
console.log("error creating table " + e.message);
});
Note: use Array of Rows, which = array of columns as input data.
Also go into module directory and run
node main.js
for more in deph tests