Print label with barcode using node.js

barcode-printing, label, node.js

Solution

Solution that it works for me, only using PDFKit. This solves the problem with barcodes.

var PDFDocument = require('pdfkit');
var fs = require('fs');

exports.printEti1015 = function printEti1015(formData){

    var marginTB = 19;
    var marginLR = 16;
    // create a document and pipe to a blob
    var doc = new PDFDocument({
        size: [432, 288] // a smaller document for small badge printers
    });

    doc.pipe(fs.createWriteStream('output.pdf'));

    //codebar
    doc.font("C:/Windows/Fonts/c39n2_0.ttf")
        .fontSize(39)
        .text ("*2017050800001*",0+marginLR,0+marginTB,{width:195,height:40,align:'center'})
    doc.font('Times-Roman')
        .fontSize(12)
        .text("codebar: 2017050800001",0+marginLR,35+marginTB,{width:195,height:20,align:'center'});

    doc.end();
}

Problem

I have a form that user has to complete. Then I keep the information into a database. And I want to print a label with the information of the form. Some of this information needs to be printed in barcode format. I tried some libraries, like fluentreports (this allows me to generate a pdf with information, it can't generate barcodes), barcode, jsbarcode, symbologi,... none of this worked for me. Can anyone help me / recommend some library to do this? Thanks!

Original source