@qr-platform/qr-code.js 0.8.17
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/.github/workflows/publish.yml +18 -0
- package/CHANGELOG.md +233 -0
- package/LICENSE.md +77 -0
- package/README.md +188 -0
- package/docs/advanced-examples.md +523 -0
- package/docs/api-reference-guide.md +254 -0
- package/docs/documentation.md +1592 -0
- package/docs/examples.md +322 -0
- package/docs/license-management.md +501 -0
- package/docs/typescript-types-definitions.md +372 -0
- package/docs/usage-guide.md +622 -0
- package/lib/core/qr-code-js.d.ts +48 -0
- package/lib/core/qr-constant.d.ts +9 -0
- package/lib/core/qr-options-validation.d.ts +13 -0
- package/lib/core/qr-svg.d.ts +76 -0
- package/lib/core/qr-templates.d.ts +6 -0
- package/lib/figures/corner-dot.d.ts +24 -0
- package/lib/figures/corner-square.d.ts +24 -0
- package/lib/figures/dot.d.ts +31 -0
- package/lib/index.d.ts +52 -0
- package/lib/lib/image/GIFImage.d.ts +19 -0
- package/lib/lib/io/Base64.d.ts +10 -0
- package/lib/lib/io/Base64DecodeInputStream.d.ts +15 -0
- package/lib/lib/io/Base64EncodeOutputStream.d.ts +17 -0
- package/lib/lib/io/ByteArrayInputStream.d.ts +12 -0
- package/lib/lib/io/ByteArrayOutputStream.d.ts +12 -0
- package/lib/lib/io/InputStream.d.ts +10 -0
- package/lib/lib/io/OutputStream.d.ts +12 -0
- package/lib/lib/qr-code.d.ts +5 -0
- package/lib/lib/qrcode/BitBuffer.d.ts +11 -0
- package/lib/lib/qrcode/ErrorCorrectLevel.d.ts +23 -0
- package/lib/lib/qrcode/MaskPattern.d.ts +39 -0
- package/lib/lib/qrcode/Mode.d.ts +23 -0
- package/lib/lib/qrcode/Polynomial.d.ts +15 -0
- package/lib/lib/qrcode/QR8BitByte.d.ts +13 -0
- package/lib/lib/qrcode/QRAlphaNum.d.ts +13 -0
- package/lib/lib/qrcode/QRCode.d.ts +22 -0
- package/lib/lib/qrcode/QRCodeMinimal.d.ts +58 -0
- package/lib/lib/qrcode/QRData.d.ts +17 -0
- package/lib/lib/qrcode/QRKanji.d.ts +13 -0
- package/lib/lib/qrcode/QRMath.d.ts +13 -0
- package/lib/lib/qrcode/QRNumber.d.ts +14 -0
- package/lib/lib/qrcode/QRUtil.d.ts +25 -0
- package/lib/lib/qrcode/RSBlock.d.ts +16 -0
- package/lib/lib/text/createStringToBytes.d.ts +9 -0
- package/lib/lib/text/stringToBytes_SJIS.d.ts +8 -0
- package/lib/lib/text/stringToBytes_UTF8.d.ts +7 -0
- package/lib/lib/zbar-wasm/index.d.ts +1 -0
- package/lib/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +410 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeReader.d.ts +29 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeSvgWriter.d.ts +46 -0
- package/lib/lib/zxing-js/src/browser/BrowserSvgCodeWriter.d.ts +49 -0
- package/lib/lib/zxing-js/src/browser/DecodeContinuouslyCallback.d.ts +6 -0
- package/lib/lib/zxing-js/src/browser/HTMLCanvasElementLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/browser/HTMLVisualMediaElement.d.ts +4 -0
- package/lib/lib/zxing-js/src/browser/VideoInputDevice.d.ts +22 -0
- package/lib/lib/zxing-js/src/browser.d.ts +3 -0
- package/lib/lib/zxing-js/src/core/ArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArithmeticException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArrayIndexOutOfBoundsException.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/BarcodeFormat.d.ts +42 -0
- package/lib/lib/zxing-js/src/core/Binarizer.d.ts +53 -0
- package/lib/lib/zxing-js/src/core/BinaryBitmap.d.ts +78 -0
- package/lib/lib/zxing-js/src/core/ChecksumException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/DecodeHintType.d.ts +91 -0
- package/lib/lib/zxing-js/src/core/Dimension.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/EncodeHintType.d.ts +99 -0
- package/lib/lib/zxing-js/src/core/Exception.d.ts +17 -0
- package/lib/lib/zxing-js/src/core/FormatException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/HighContrastLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/core/IllegalArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IllegalStateException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IndexOutOfBoundsException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/InvertedLuminanceSource.d.ts +22 -0
- package/lib/lib/zxing-js/src/core/LuminanceSource.d.ts +84 -0
- package/lib/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/NotFoundException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/NullPointerException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/OutOfMemoryError.d.ts +6 -0
- package/lib/lib/zxing-js/src/core/PlanarYUVLuminanceSource.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/RGBLuminanceSource.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/Reader.d.ts +49 -0
- package/lib/lib/zxing-js/src/core/ReaderException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ReedSolomonException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Result.d.ts +52 -0
- package/lib/lib/zxing-js/src/core/ResultMetadataType.d.ts +68 -0
- package/lib/lib/zxing-js/src/core/ResultPoint.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/ResultPointCallback.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/UniversalLuminanceSource.d.ts +46 -0
- package/lib/lib/zxing-js/src/core/UnsupportedOperationException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Writer.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/WriterException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/common/BitArray.d.ts +111 -0
- package/lib/lib/zxing-js/src/core/common/BitMatrix.d.ts +98 -0
- package/lib/lib/zxing-js/src/core/common/BitSource.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/common/CharacterSetECI.d.ts +89 -0
- package/lib/lib/zxing-js/src/core/common/DecoderResult.d.ts +64 -0
- package/lib/lib/zxing-js/src/core/common/DefaultGridSampler.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/common/DetectorResult.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/common/ECIEncoderSet.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/common/ECIInput.d.ts +79 -0
- package/lib/lib/zxing-js/src/core/common/GlobalHistogramBinarizer.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/common/GridSampler.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/GridSamplerInstance.d.ts +18 -0
- package/lib/lib/zxing-js/src/core/common/HybridBinarizer.d.ts +54 -0
- package/lib/lib/zxing-js/src/core/common/MinimalECIInput.d.ts +123 -0
- package/lib/lib/zxing-js/src/core/common/PerspectiveTransform.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/common/StringUtils.d.ts +48 -0
- package/lib/lib/zxing-js/src/core/common/detector/CornerDetector.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/common/detector/MathUtils.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/detector/WhiteRectangleDetector.d.ts +71 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGF.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGFPoly.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGF.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGFPoly.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonDecoder.d.ts +40 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonEncoder.d.ts +41 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeReader.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeWriter.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/BitMatrixParser.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataBlock.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataMask.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DecodedBitStreamParser.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Decoder.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECB.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECBlocks.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ErrorCorrectionLevel.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/FormatInformation.d.ts +33 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Mode.d.ts +56 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/QRCodeDecoderMetaData.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Version.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPattern.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPatternFinder.d.ts +82 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/Detector.d.ts +87 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPattern.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternFinder.d.ts +114 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternInfo.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/BlockPair.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/ByteMatrix.d.ts +24 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/Encoder.d.ts +85 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MaskUtil.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MatrixUtil.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/QRCode.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/util/Arrays.d.ts +45 -0
- package/lib/lib/zxing-js/src/core/util/ByteArrayOutputStream.d.ts +174 -0
- package/lib/lib/zxing-js/src/core/util/Charset.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/Collections.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/util/Float.d.ts +14 -0
- package/lib/lib/zxing-js/src/core/util/Formatter.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/util/Integer.d.ts +19 -0
- package/lib/lib/zxing-js/src/core/util/Long.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/util/OutputStream.d.ts +106 -0
- package/lib/lib/zxing-js/src/core/util/StandardCharsets.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/StringBuilder.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/util/StringEncoding.d.ts +51 -0
- package/lib/lib/zxing-js/src/core/util/System.d.ts +10 -0
- package/lib/lib/zxing-js/src/customTypings.d.ts +16 -0
- package/lib/lib/zxing-js/src/index.d.ts +5 -0
- package/lib/lib/zxing-js/src/node.d.ts +1 -0
- package/lib/license/LicenseManager.d.ts +69 -0
- package/lib/license/LicenseManagerNode.d.ts +64 -0
- package/lib/node.d.ts +37 -0
- package/lib/options-demo.d.ts +239 -0
- package/lib/plugins/QRBorderHelpers.d.ts +32 -0
- package/lib/plugins/QRBorderPlugin.d.ts +35 -0
- package/lib/plugins/QRValidatorZbar.d.ts +38 -0
- package/lib/plugins/QRValidatorZbarNode.d.ts +60 -0
- package/lib/plugins/QRValidatorZbarNodeSharp.d.ts +83 -0
- package/lib/qr-code-js-node.js +1 -0
- package/lib/qr-code-js.js +1 -0
- package/lib/templates/borders-inner-outter.d.ts +129 -0
- package/lib/templates/borders-inner-scale-offset.d.ts +497 -0
- package/lib/templates/borders-inner.d.ts +129 -0
- package/lib/templates/borders-no-license.d.ts +129 -0
- package/lib/templates/borders-outter.d.ts +129 -0
- package/lib/templates/borders-text-auto-curved.d.ts +129 -0
- package/lib/templates/borders-text-full-curved.d.ts +133 -0
- package/lib/templates/borders.d.ts +129 -0
- package/lib/templates/scales.d.ts +130 -0
- package/lib/templates/scan-validators/index.d.ts +1 -0
- package/lib/templates/scan-validators/tests/cases/basic-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/basic-no-license.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/basic.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/colors-inverted.d.ts +2 -0
- package/lib/templates/scan-validators/tests/cases/colors.d.ts +58 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position.d.ts +3 -0
- package/lib/templates/scan-validators/tests/index.d.ts +27 -0
- package/lib/tools/browser-image-tools.d.ts +7 -0
- package/lib/tools/browser-utils.d.ts +18 -0
- package/lib/types/helper.d.ts +23 -0
- package/lib/utils/canvas-options.d.ts +7 -0
- package/lib/utils/color.d.ts +4 -0
- package/lib/utils/gradient.d.ts +26 -0
- package/lib/utils/image.d.ts +16 -0
- package/lib/utils/merge.d.ts +5 -0
- package/lib/utils/options.d.ts +220 -0
- package/lib/utils/qrcode.d.ts +8 -0
- package/lib/utils/scan-validator-node.d.ts +15 -0
- package/lib/utils/scan-validators/abstract-scan-validator.d.ts +43 -0
- package/lib/utils/scan-validators/zbar-scan-validator.d.ts +8 -0
- package/lib/utils/scan-validators/zxing-canvas-scan-validator.d.ts +10 -0
- package/lib/utils/scan-validators/zxing-scan-validator.d.ts +8 -0
- package/lib/utils/svg.d.ts +2 -0
- package/lib/utils/token-validator.d.ts +19 -0
- package/package.json +80 -0
@@ -0,0 +1,254 @@
|
|
1
|
+
## API Reference Guide for QRCode.js Library
|
2
|
+
<a id="start"></a>
|
3
|
+
|
4
|
+
### Basic Usage
|
5
|
+
|
6
|
+
```typescript
|
7
|
+
import { QRCodeJs, Options } from '@qr-platform/qr-code.js';
|
8
|
+
|
9
|
+
// Create a basic QR code
|
10
|
+
const qrCode = new QRCodeJs({
|
11
|
+
data: 'https://example.com',
|
12
|
+
} as Options);
|
13
|
+
|
14
|
+
// Render the QR code to a container
|
15
|
+
qrCode.append(document.getElementById('qr-container'));
|
16
|
+
```
|
17
|
+
|
18
|
+
### QRCode.js Options Table
|
19
|
+
|
20
|
+
| Option | Type | Default | Description |
|
21
|
+
| :--------------------- | :------------------------------------- | :------------- | :-------------------------------------------------------------------------- |
|
22
|
+
| `data` | `string` | - | Specifies the text, URL, or other data to encode into the QR code. **Required option** |
|
23
|
+
| `shape` | `'square' \| 'circle'` | `'square'` | The overall shape of the QR code's boundary. See [ShapeType](#enums-shapetype) enum.
|
24
|
+
| `margin` | `number` | `0` | The quiet zone (empty space) around the QR code in pixels. |
|
25
|
+
| `isResponsive` | `boolean` | `false` | When `true`, the QR code SVG resizes dynamically to fill the width or height of the parent container, with no internal size dimensions applied. |
|
26
|
+
| `scale` | `number` (0 to 1.5) | `1` | Scales the QR code size relative to its container or border. |
|
27
|
+
| `offset` | `number` | `0` | Applies a vertical offset (positive moves down, negative moves up) relative to the center. |
|
28
|
+
| `verticalOffset` | `number` | `0` | Applies an absolute vertical offset in pixels. |
|
29
|
+
| `horizontalOffset` | `number` | `0` | Applies an absolute horizontal offset in pixels. |
|
30
|
+
| `qrOptions` | `object` | `{...}` | Options related to the underlying QR code generation algorithm. |
|
31
|
+
| `qrOptions.typeNumber` | `number` (0-40) | `0` | Specifies the QR code version (size/capacity). `0` means automatic detection. |
|
32
|
+
| `qrOptions.mode` | `Mode` enum | Auto-detected | The encoding mode (e.g., `Byte`, `Numeric`, `Kanji`). Usually auto-detected. |
|
33
|
+
| `qrOptions.errorCorrectionLevel` | `'L' \| 'M' \| 'Q' \| 'H'` | `'Q'` | The error correction level, determining redundancy. See [ErrorCorrectionLevel](#enums-errorcorrectionlevel) enum.
|
34
|
+
| `dotsOptions` | `object` | `{...}` | Options for styling the dots in the QR code. |
|
35
|
+
| `dotsOptions.type` | `DotType` enum | `'square'` | The shape of the dots. See [DotType](#enums-dottype) enum.
|
36
|
+
| `dotsOptions.color` | `string` | `'#000000'` | The color of the dots. Accepts any valid CSS color string (e.g., `'#FF0000'`, `'red'`, `'rgba(255, 0, 0, 0.5)'`).
|
37
|
+
| `dotsOptions.size` | `number` | `10` | The size of the dots in pixels. |
|
38
|
+
| `dotsOptions.gradient` | `Gradient` object | `undefined` | Apply a gradient fill to the dots. See [`Gradient options`](#gradientoptions) for configuration details.
|
39
|
+
| `type` | `'linear' \| 'radial'` | - | Specifies the type of gradient: 'linear' for a linear gradient or 'radial' for a radial gradient. |
|
40
|
+
| `rotation` | `number` | - | The rotation angle in radians for the gradient. Only applicable when `type` is 'linear'. |
|
41
|
+
| `colorStops`| `Array<{ offset: number, color: string }>` | - | An array of color stops that define the gradient. Each stop must have an `offset` (a number between 0 and 1) and a `color` (a valid CSS color string). At least two color stops are recommended to create a visible gradient.
|
42
|
+
| `cornersSquareOptions` | `object` | `{...}` | Options for styling the corner squares. Overrides `dotsOptions`. |
|
43
|
+
| `cornersSquareOptions.type` | `CornerSquareType` enum | Inherits | The shape of the corner squares. See [CornerSquareType](#enums-cornersquaretype) enum for options (e.g., square, rounded).
|
44
|
+
| `cornersSquareOptions.color` | `string` | Inherits | The color of the corner squares. |
|
45
|
+
| `cornersSquareOptions.gradient` | `Gradient` object | `undefined` | Apply a gradient fill to the corner squares. |
|
46
|
+
| `cornersDotOptions` | `object` | `{...}` | Options for styling the corner dots. Overrides `cornersSquareOptions`. |
|
47
|
+
| `backgroundOptions` | `object \| false` | `{...}` | Options for styling the background. Set to `false` to disable. |
|
48
|
+
| `backgroundOptions.color` | `string` | `'#FFFFFF'` | The background color. |
|
49
|
+
| `backgroundOptions.round` | `number \| string` | `0` | Rounds the corners of the background (0-1 or percentage). |
|
50
|
+
| `backgroundOptions.gradient` | `Gradient` object | `undefined` | Apply a gradient fill to the background. See [Gradient options](#gradientoptions) for configuration details.
|
51
|
+
| `image` | `string \| Buffer \| Blob` | `undefined` | URL, Buffer, or Blob of an image to embed in the QR code. |
|
52
|
+
| `imageOptions` | `object` | `{...}` | Options for the embedded image. |
|
53
|
+
| `imageOptions.mode` | `ImageMode` enum | `'center'` | How the image is embedded. See `ImageMode` enum. |
|
54
|
+
| `imageOptions.imageSize` | `number` | `0.4` | Relative size of the image (0-1). |
|
55
|
+
| `imageOptions.margin` | `number` | `0` | Margin around the image in dot units. |
|
56
|
+
| `imageOptions.crossOrigin` | `string` | `undefined` | CORS setting for the image. |
|
57
|
+
| `imageOptions.fill` | `object` | `{...}` | Fill `color` or `gradient`. |
|
58
|
+
| `imageOptions.fill.color` | `string` | `'rgba(255,255,255,1)'` | Fill color.
|
59
|
+
| `imageOptions.fill.gradient` | `Gradient` object | `undefined` | Apply a gradient fill to the QR code. See [Gradient options](#gradientoptions) for configuration details.
|
60
|
+
| `borderOptions` | `BorderOptions` object | `undefined` | Options for adding decorative borders. See below for sub-options. **Premium option** |
|
61
|
+
|
62
|
+
---
|
63
|
+
|
64
|
+
<a id="gradientoptions"></a>
|
65
|
+
### Gradient options
|
66
|
+
**Note**: If both `color` and `gradient` are specified, the `gradient` property takes precedence, allowing you to create dynamic linear or radial gradient effects.
|
67
|
+
|
68
|
+
|
69
|
+
| Option | Type | Default | Description |
|
70
|
+
|--------------------------|---------------------|------------|-----------------------------------------------------------------------------|
|
71
|
+
| `cornersDotOptions.type` | `CornerDotType` enum| `Inherits` | Specifies the shape of the corner dots. Refer to the `CornerDotType` enum for available options (e.g., square, rounded). |
|
72
|
+
| `cornersDotOptions.color`| `string` | `Inherits` | Defines the solid color of the corner dots. Accepts any valid CSS color string (e.g., `'#FF0000'`, `'red'`, `'rgba(255, 0, 0, 0.5)'`). |
|
73
|
+
| `cornersDotOptions.gradient` | `Gradient` object | `undefined`| Applies a gradient fill to the corner dots, overriding the `color` property if both are set. See [Gradient Sub-options](#gradient-sub-options) for configuration details. |
|
74
|
+
|
75
|
+
### Additional Notes
|
76
|
+
- The `data` option is the only required option for generating a QR code.
|
77
|
+
- Premium features like `borderOptions` and `validateScanning` require a valid license to use.
|
78
|
+
|
79
|
+
---
|
80
|
+
|
81
|
+
### QRCode.js Methods Table
|
82
|
+
|
83
|
+
| Method | Parameters | Description |
|
84
|
+
| :------------------ | :------------------------------------------------------------------------- | :-------------------------------------------------------------------------- |
|
85
|
+
| `append` | `container: HTMLElement` | Appends the QR code to a container element. Returns `QRCodeJs \| undefined`. |
|
86
|
+
| `serialize` | `inverted?: boolean` | Converts the QR code to an SVG string. Returns `Promise<string \| undefined>`. |
|
87
|
+
| `download` | `downloadOptions?: { name?: string; extension: 'svg' \| 'png' \| 'jpeg' \| 'webp' }, canvasOptions?: CanvasOptions` | Downloads the QR code as a file. Returns `Promise<void>`. |
|
88
|
+
| `update` | `options?: RecursivePartial<Options>` | Updates the QR code with new options. Returns `void`. |
|
89
|
+
| `validateScanning` | `validatorId?: string, debug?: boolean` | **(Premium method)** Validates that the QR code is scannable. Returns `Promise<ScanValidatorResponse>`. |
|
90
|
+
|
91
|
+
---
|
92
|
+
<a id="borderoptions"></a>
|
93
|
+
### borderOptions Options
|
94
|
+
|
95
|
+
The `borderOptions` object is a premium feature that allows you to add decorative borders around the QR code. This options can be used to customize the borders, including the color, thickness, text and corner rounding. If used without a license, the library will automatically add "QR-Platform" branding text in the bottom border.
|
96
|
+
|
97
|
+
| Sub-option | Type | Default | Description |
|
98
|
+
| :-------------------- | :------------------------------------- | :------------- | :-------------------------------------------------------------------------- |
|
99
|
+
| `hasBorder` | `boolean` | `false` | Master switch to enable/disable borders. |
|
100
|
+
| `thickness` | `number` | `50` | Thickness of the main border in pixels. |
|
101
|
+
| `color` | `string` | `'#000000'` | Color of the main border. |
|
102
|
+
| `radius` | `string` | `'0%'` | Corner rounding of the border (e.g., `'10%'`, `'20px'`). |
|
103
|
+
| `noBorderThickness` | `number` | `thickness / 4`| Thickness for border sides with disabled decorations. |
|
104
|
+
| `background` | `string` | `undefined` | Background color for the border area. |
|
105
|
+
| `inner` | `object` | `{}` | Options for scaling/offsetting the inner content area. |
|
106
|
+
| `inner.radius` | `string` | `'0%'` | Corner rounding of the inner border. |
|
107
|
+
| `inner.scale` | `number` (0 to 1.5) | `1` | Scale factor for the inner content. |
|
108
|
+
| `inner.horizontalOffset` | `number` | `0` | Horizontal offset of the inner content. |
|
109
|
+
| `inner.verticalOffset` | `number` | `0` | Vertical offset of the inner content. |
|
110
|
+
| `borderOuter` | `object` | `{}` | Options for an additional outer border. |
|
111
|
+
| `borderOuter.color` | `string` | `'#000000'` | Color of the outer border. |
|
112
|
+
| `borderOuter.thickness` | `number` | `10` | Thickness of the outer border. |
|
113
|
+
| `borderInner` | `object` | `{}` | Options for an additional inner border. |
|
114
|
+
| `borderInner.color` | `string` | `'#000000'` | Color of the inner border. |
|
115
|
+
| `borderInner.thickness` | `number` | `5` | Thickness of the inner border. |
|
116
|
+
| `decorations` | `object` | `{}` | Add text or images to specific sides of the border. |
|
117
|
+
| `decorations.top` | `DecorationOptions` object | `{}` | Decoration options for the top side. See [DecorationOptions](#decorationoptions) for details.
|
118
|
+
| `decorations.right` | `DecorationOptions` object | `{}` | Decoration options for the right side. See [DecorationOptions](#decorationoptions) for details. |
|
119
|
+
| `decorations.bottom` | `DecorationOptions` object | `{}` | Decoration options for the bottom side. See [DecorationOptions](#decorationoptions) for details. |
|
120
|
+
| `decorations.left` | `DecorationOptions` object | `{}` | Decoration options for the left side. See [DecorationOptions](#decorationoptions) for details. |
|
121
|
+
|
122
|
+
**Note**: Each `DecorationOptions` object can include properties such as `disabled`, `enableText`, `offset`, `curveAdjustment`, `curveDisabled`, `curveRadius`, `type` (`'text'` or `'image'`), `value`, and `style` for text styling.
|
123
|
+
|
124
|
+
<a id="decorationoptions"></a>
|
125
|
+
### DecorationOptions Options
|
126
|
+
|
127
|
+
| Option | Type | Default | Description |
|
128
|
+
|--------------------|----------------------------------------|----------------|-----------------------------------------------------------------------------|
|
129
|
+
| `disabled` | `boolean` | `false` | Whether the decoration for this side is disabled. |
|
130
|
+
| `enableText` | `boolean` | `false` | Whether to enable text on this side of the border. |
|
131
|
+
| `offset` | `number` | `0` | Positioning offset for the decoration. |
|
132
|
+
| `curveAdjustment` | `number` | `0` | Adjustment for the text curve. |
|
133
|
+
| `curveDisabled` | `boolean` | `false` | Whether to disable curved text. |
|
134
|
+
| `curveRadius` | `string` | `'50%'` | Radius of the text curve (e.g., `'50%'`, `'100px'`). |
|
135
|
+
| `type` | `'text' \| 'image'` | `'text'` | The type of decoration to use (`'text'` or `'image'`). |
|
136
|
+
| `value` | `string` | `''` | The text content or image URL for the decoration. |
|
137
|
+
| `style` | `object` | `{}` | Style options for text decorations. |
|
138
|
+
| `style.fontFace` | `string` | `'Helvetica'` | The font face for the text. |
|
139
|
+
| `style.fontSize` | `number` | `28` | The font size for the text in pixels. |
|
140
|
+
| `style.fontColor` | `string` | `'#ffffff'` | The color of the text. |
|
141
|
+
| `style.letterSpacing` | `number` | `0` | The letter spacing for the text in pixels. |
|
142
|
+
| `style.fontWeight` | `'normal' \| 'bold'` | `'normal'` | The font weight for the text. |
|
143
|
+
|
144
|
+
### Enums
|
145
|
+
|
146
|
+
These enums provide predefined values for certain properties, ensuring type safety.
|
147
|
+
|
148
|
+
<a id="enums-shapetype"></a>
|
149
|
+
##### ShapeType
|
150
|
+
|
151
|
+
```typescript
|
152
|
+
enum ShapeType {
|
153
|
+
square = 'square',
|
154
|
+
circle = 'circle'
|
155
|
+
}
|
156
|
+
```
|
157
|
+
|
158
|
+
<a id="enums-mode"></a>
|
159
|
+
##### Mode
|
160
|
+
|
161
|
+
```typescript
|
162
|
+
enum Mode {
|
163
|
+
numeric = 'numeric',
|
164
|
+
alphanumeric = 'alphanumeric',
|
165
|
+
byte = 'byte',
|
166
|
+
kanji = 'kanji',
|
167
|
+
unicode = 'unicode'
|
168
|
+
}
|
169
|
+
```
|
170
|
+
|
171
|
+
<a id="enums-errorcorrectionlevel"></a>
|
172
|
+
##### ErrorCorrectionLevel
|
173
|
+
|
174
|
+
```typescript
|
175
|
+
enum ErrorCorrectionLevel {
|
176
|
+
L = 'L', // 7% error recovery
|
177
|
+
M = 'M', // 15% error recovery
|
178
|
+
Q = 'Q', // 25% error recovery
|
179
|
+
H = 'H' // 30% error recovery
|
180
|
+
}
|
181
|
+
```
|
182
|
+
|
183
|
+
<a id="enums-dottype"></a>
|
184
|
+
##### DotType
|
185
|
+
|
186
|
+
```typescript
|
187
|
+
enum DotType {
|
188
|
+
dot = 'dot',
|
189
|
+
square = 'square',
|
190
|
+
rounded = 'rounded',
|
191
|
+
extraRounded = 'extra-rounded',
|
192
|
+
classy = 'classy',
|
193
|
+
classyRounded = 'classy-rounded',
|
194
|
+
verticalLine = 'vertical-line',
|
195
|
+
horizontalLine = 'horizontal-line',
|
196
|
+
randomDot = 'random-dot',
|
197
|
+
smallSquare = 'small-square',
|
198
|
+
tinySquare = 'tiny-square',
|
199
|
+
star = 'star',
|
200
|
+
plus = 'plus',
|
201
|
+
diamond = 'diamond'
|
202
|
+
}
|
203
|
+
```
|
204
|
+
|
205
|
+
<a id="enums-cornersquaretype"></a>
|
206
|
+
##### CornerSquareType
|
207
|
+
|
208
|
+
```typescript
|
209
|
+
enum CornerSquareType {
|
210
|
+
dot = 'dot',
|
211
|
+
square = 'square',
|
212
|
+
rounded = 'rounded',
|
213
|
+
classy = 'classy',
|
214
|
+
outpoint = 'outpoint',
|
215
|
+
inpoint = 'inpoint'
|
216
|
+
}
|
217
|
+
```
|
218
|
+
|
219
|
+
<a id="enums-cornerdottype"></a>
|
220
|
+
##### CornerDotType
|
221
|
+
|
222
|
+
```typescript
|
223
|
+
enum CornerDotType {
|
224
|
+
dot = 'dot',
|
225
|
+
square = 'square',
|
226
|
+
heart = 'heart',
|
227
|
+
rounded = 'rounded',
|
228
|
+
classy = 'classy',
|
229
|
+
outpoint = 'outpoint',
|
230
|
+
inpoint = 'inpoint'
|
231
|
+
}
|
232
|
+
```
|
233
|
+
|
234
|
+
<a id="enums-imagemode"></a>
|
235
|
+
##### ImageMode
|
236
|
+
|
237
|
+
```typescript
|
238
|
+
enum ImageMode {
|
239
|
+
center = 'center',
|
240
|
+
overlay = 'overlay',
|
241
|
+
background = 'background'
|
242
|
+
}
|
243
|
+
```
|
244
|
+
|
245
|
+
---
|
246
|
+
|
247
|
+
### See Also
|
248
|
+
- [QRCode.js Documentation](./documentation.md#start)
|
249
|
+
- [Quick References Guide](./quick-references-guide.md#start)
|
250
|
+
- [API Reference Guide](./api-reference-guide.md#start)
|
251
|
+
- [TypeScript Types and Definitions](./typescript-types-definitions.md#start)
|
252
|
+
- [License Management](./license-management.md#start)
|
253
|
+
- [Basic Examples](./examples.md#start)
|
254
|
+
- [Advanced Examples](./advanced-examples.md#start)
|