Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用node.js打印带有条形码的标签_Node.js_Labels_Barcode Printing - Fatal编程技术网

使用node.js打印带有条形码的标签

使用node.js打印带有条形码的标签,node.js,labels,barcode-printing,Node.js,Labels,Barcode Printing,我有一个用户必须填写的表单。 然后我将信息保存到数据库中 我想打印一个带有表单信息的标签 其中一些信息需要以条形码格式打印 我尝试了一些库,比如fluentreports(这允许我生成包含信息的pdf,但不能生成条形码)、barcode、jsbarcode、symbologi等等,。。。这些对我都不起作用 有人能帮我/推荐一些图书馆来做这件事吗 谢谢 解决方案,它对我有效,只使用PDFKit。 这就解决了条形码的问题 var PDFDocument = require('pdfkit'); va

我有一个用户必须填写的表单。 然后我将信息保存到数据库中

我想打印一个带有表单信息的标签

其中一些信息需要以条形码格式打印

我尝试了一些库,比如fluentreports(这允许我生成包含信息的pdf,但不能生成条形码)、barcode、jsbarcode、symbologi等等,。。。这些对我都不起作用

有人能帮我/推荐一些图书馆来做这件事吗


谢谢

解决方案,它对我有效,只使用PDFKit。 这就解决了条形码的问题

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

你能猜一猜为什么你试过的都不管用吗?你遇到了什么问题?你提到的一些图书馆每天都被其他人使用。我解决了所有的问题!如何打印多个标签?在您的示例中,您有两个选项。。。1-可以使用addPage(),并复制标签的所有代码。始终会打印2个标签。2-打印时,选择2份。尝试此解决方案。这对我有用。