首页 > 解决方案 > node-qrcode 无法设置更大的宽度

问题描述

我正在使用 node-qrcode https://github.com/soldair/node-qrcode

我可以成功生成二维码并将其写入文件。但我需要使文件更大。但是,从节点内部,当我传递宽度选项时,它不会听它。我只能从 CLI 中让它工作,这有利于测试,但从长远来看是行不通的。

这是我的代码片段:

    const QRCode = require('qrcode');

    //generates the QR code png
    function generateQR(customer){
        let qrfilename = customer['phone'] + '.png'
        QRCode.toFile(qrfilename, customer['phone'], {width: '600'});
    }

当我从命令行运行时,它可以工作

./qrcode -d F00 -w 600 -o out.png "some text"

标签: node.jsnode-modulesqr-code

解决方案


推荐阅读