What is voilab pdf table?
Voilab-pdf-table is a Node.js library that allows developers to easily create tables in PDF documents using PDFKit. It provides a simple and easy-to-use API for creating tables with various options for customizing the appearance of the table, such as font size, colors, and borders.![]() |
What is voilab pdf table? |
Here is an example of how to use Voilab-pdf-table to create a simple table in a PDF document:
const PDFDocument = require('pdfkit');
const pdfTable = require('voilab-pdf-table');
const doc = new PDFDocument();
const table = new pdfTable(doc, {
bottomMargin: 30
});
table
.addColumns([
{
id: 'item',
header: 'Item',
width: 100
},
{
id: 'description',
header: 'Description',
width: 300
},
{
id: 'price',
header: 'Price',
width: 50,
align: 'right'
}
])
.onPageAdded(function(tb) {
tb.addBody([
{ item: 'Item 1', description: 'Description 1', price: '$1' },
{ item: 'Item 2', description: 'Description 2', price: '$2' }
]);
});
doc.pipe(fs.createWriteStream('table.pdf'));
doc.end();
Voilab-pdf-table is a great tool for developers who want to create tables in their PDF documents. It provides an easy-to-use API and a wide range of options for customizing the appearance of the table. It's also compatible with PDFKit, so developers can easily integrate it into their existing PDF creation workflow.