Skip to content

Simple npm module for print tags in many formats

License

Notifications You must be signed in to change notification settings

rederlo/print-tag

 
 

Repository files navigation

Print tags

NPM version Build Status Coverage Status

Node.js module to generate PDFs in commercial tags formats and ready to print

Installation

npm install --save print-tag

Usage

// 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();
});

Formats

Please help with more formats in: https://github.com/albertosouza/print-tag/blob/master/lib/formats.js

Avaible:

  • pimaco_6187
  • pimaco_6180

Example:

Page printed with tags in pimaco 6187 format

Authors

License

MIT © Alberto Souza

About

Simple npm module for print tags in many formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%