xl-public-utils 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -832,6 +832,8 @@ declare module "xl-public-utils" {
832
832
  guardrightpos?: number | undefined;
833
833
  guardleftypos?: number | undefined;
834
834
  guardrightypos?: number | undefined;
835
+ eclevel?: 'L' | 'M' | 'Q' | 'H',
836
+ version?: number
835
837
  }
836
838
  export interface RenderOptions extends BwippOptions {
837
839
  bcid: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xl-public-utils",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
package/src/qrcode.js CHANGED
@@ -43,6 +43,8 @@ export function generateQRCodeWithText(content, options = {}) {
43
43
  textLeftMargin = 20,
44
44
  fontWeight = 700,
45
45
  textColor = '#000',
46
+ eclevel,
47
+ version,
46
48
  textContent
47
49
  } = options
48
50
  /**
@@ -75,6 +77,9 @@ export function generateQRCodeWithText(content, options = {}) {
75
77
  const tempCanvas = document.createElement('canvas');
76
78
  tempCanvas.width = qrcodeW;
77
79
  tempCanvas.height = qrcodeH;
80
+ const otherOpts = {};
81
+ if(eclevel) otherOpts['eclevel'] = eclevel;
82
+ if(version) otherOpts['version'] = version;
78
83
  try {
79
84
  generFunc(tempCanvas, {
80
85
  bcid: bcid, // Barcode type
@@ -83,6 +88,7 @@ export function generateQRCodeWithText(content, options = {}) {
83
88
  width: qrcodeW, // QR code width
84
89
  height: qrcodeH, // QR code height
85
90
  includetext: false, // Do not include text below QR code
91
+ ...otherOpts
86
92
  });
87
93
  // Draw the QR code on the left (300x300), centered vertically at (0, 21)
88
94
  ctx.drawImage(tempCanvas, left, top, qrcodeW, qrcodeH);