0

当我使用 easyqrcodejs-nodejs 生成 qr 图像并将其保存在 azure 存储中时,图像中的文本变为正方形。为什么会这样?我使用 pdfkit 和 jspdf 作为 pdf 生成器。当我生成和保存 pdf 时也会发生这种情况

  var options = {
    text: link,
    logo: "https://spadesprodblob.blob.core.windows.net/file-storage/restaurant/1641807876154-lg1.png",
    width: 220,
    height: 220,
    colorDark: "#000000",
    colorLight: "#ffffff",
    correctLevel: QRCode.CorrectLevel.H, // L, M, Q, H
    title:`Table#${title}`, 
    titleFont: "normal normal bold 20px Arial", //font. default is "bold 16px Arial"
    titleColor: "#000", // color. default is "#000"
    titleBackgroundColor: "#fff", // background color. default is "#fff"
    titleHeight: 30, // height, including subTitle. default is 0
    titleTop: 10, // draws y coordinates. default is 30
    subTitle: wifi,
    subTitleFont: "normal normal normal 14px Arial", // font. default is "14px Arial"
    subTitleColor: "#000", // color. default is "4F4F4F"
    subTitleTop: 320, // draws y coordinates. default is 0
    quietZoneColor: "rgba(255, 255, 255,0)",
    quietZone: 75,
    backgroundImage: 'https://spadesprodblob.blob.core.windows.net/file-storage/restaurant/1641802309587-background.png', // Background Image
    backgroundImageAlpha: 1, // Background image transparency, value between 0 and 1. default is 1.
    autoColorDark: "rgba(0, 0, 0, .6)",
    binary: true,
  };

  // New instance with options
  var qrcode = new QRCode(options);
    const qr_code_url = await RestaurantService.uploadImageByPath(imageTemppath);
    console.log(QRRes)
    const image_base_url = await qrcode.toDataURL().then(data => {
      return data
    });
    var doc = new jsPDF();


    doc.addImage(image_base_url, 'PNG', 2, 20, 200, 200);
4

0 回答 0