print-tag
Version:
Simple module to generate PDF tags for print in comercial formats
79 lines (55 loc) • 2.2 kB
Markdown
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [](https://coveralls.io/github/albertosouza/print-tag?branch=master)
Node.js module to generate PDFs in commercial tags formats and ready to print
```js
npm install --save print-tag
```
```js
// See all avaible formats in: https://github.com/albertosouza/print-tag/blob/master/lib/formats.js
var pt = new PrintTicket('pimaco_6187');
// write in test/results/output.pdf , see PDFkit documentation
pt.doc.pipe( fs.createWriteStream('test/results/output.pdf') );
pt.doc.fontSize(6);
pt.makeTickets({
count: data.length
}, function onSetOneTag(i, marginLeft, marginTop, size, next) {
// write something in tag area
pt.doc.text(data[i].name, marginLeft, marginTop, size);
// ticket box
pt.doc.lineWidth(0.1);
pt.doc.rect(marginLeft, marginTop, size.width, size.height).stroke();
// run next function
next();
}, function afterSetAllTags(){
// end, required for end / finish the PDF file
pt.doc.end();
});
pt.doc.on('end', function(){
done();
});
```
Please help with more formats in: https://github.com/albertosouza/print-tag/blob/master/lib/formats.js
- pimaco_6187
- pimaco_6180
- pimaco_6081
- pimaco_a4355

- Alberto Souza: http://albertosouza.net
- Thiago Anselmo: https://github.com/thiagoanselmo
- Angelo Dias: https://github.com/angelod1as
- Luiza Avelino: https://github.com/luiza-avelino
MIT © [Alberto Souza](http://albertosouza.net)
[]: https://badge.fury.io/js/print-tag.svg
[]: https://npmjs.org/package/print-tag
[]: https://travis-ci.org/albertosouza/print-tag.svg?branch=master
[]: https://travis-ci.org/albertosouza/print-tag
[]: https://david-dm.org/albertosouza/print-tag.svg?theme=shields.io
[]: https://david-dm.org/albertosouza/print-tag