1.4.4 • Published 6 years ago

qrcode-generator v1.4.4

Weekly downloads
19,163
License
MIT
Repository
github
Last release
6 years ago

QR Code Generator

Getting Started

  1. Include qrcode.js in your html.
  2. Prepare a place holder.
  3. Generate QR and render it.
<script type="text/javascript" src="qrcode.js"></script>
<div id="placeHolder"></div>
var typeNumber = 4;
var errorCorrectionLevel = 'L';
var qr = qrcode(typeNumber, errorCorrectionLevel);
qr.addData('Hi!');
qr.make();
document.getElementById('placeHolder').innerHTML = qr.createImgTag();

API Documentation

QRCodeFactory

qrcode(typeNumber, errorCorrectionLevel) => QRCode

Create a QRCode Object.

ParamTypeDescription
typeNumbernumberType number (1 ~ 40), or 0 for auto detection.
errorCorrectionLevelstringError correction level ('L', 'M', 'Q', 'H')

qrcode.stringToBytes(s) : number[]

Encodes a string into an array of number(byte) using any charset. This function is used by internal. Overwrite this function to encode using a multibyte charset.

ParamTypeDescription
sstringstring to encode

QRCode

addData(data, mode) => void

Add a data to encode.

ParamTypeDescription
datastringstring to encode
modestringMode ('Numeric', 'Alphanumeric', 'Byte'(default), 'Kanji')

make() => void

Make a QR Code.

getModuleCount() => number

The number of modules(cells) for each orientation. Note call make() before this function.

isDark(row, col) => boolean

The module at row and col is dark or not. Note call make() before this function.

ParamTypeDescription
rownumber0 ~ moduleCount - 1
colnumber0 ~ moduleCount - 1

createDataURL(cellSize, margin) => string

createImgTag(cellSize, margin, alt) => string

createSvgTag(cellSize, margin) => string

createTableTag(cellSize, margin) => string

createASCII(cellSize, margin) => string

Helper functions for HTML. Note call make() before these functions.

ParamTypeDescription
cellSizenumberdefault: 2
marginnumberdefault: cellSize * 4
altstring(optional)

createSvgTag(opts) => string

ParamTypeDescription
optsobjectdefault: {}
opts.cellSizenumberdefault: 2
opts.marginnumberdefault: cellSize * 4
opts.scalablebooleandefault: false

renderTo2dContext(context, cellSize) => void

--

This implementation is based on JIS X 0510:1999.

The word 'QR Code' is registered trademark of DENSO WAVE INCORPORATED http://www.denso-wave.com/qrcode/faqpatent-e.html

@autharmor/uicommuni-design-system@conclurer/brickstaler-wallet@daivalogix/digital-verification-widget@thesis-co/mechamittens-extensionnode-qr-code-styling@frog-res/h-utils@infinitebrahmanuniverse/nolb-qrnanocurrency.js@everything-registry/sub-chunk-2510@polkadot-cloud/recipes-testtctipsvg-qrsvgqr.jssvg-image-editorweex-qrcodethanglv-qrcode-styling@driesvanbilloen/qr-code-styling@cvcode/qr-code-styling@dr-coton/qr-code-styling@buza_me/qr-code-styling@payping/utils@perseveranza-pets/freyaipanel-rntv-corejustride-qrcodekjua-revivedstyled-qr-codestyled-qr-code-nodestyled-qr-code-node-typescriptsqrcspace-vue3-qrcodetrioslibtokes-payments-component@aiddroid/qr-code-styling@asoftwareworld/qrcode@autharmor/autharmor-js-ui@alexdigi/qr-code-styling@awesome-qrcode/react@axia-js/react-qr@axiasolar-js/react-qr@binsky/passman-client-ts@byte.n/qrcode-vue3@chromapdx/qr-code-styling@ckho/qr-code-styling@charles-goode/qr-code-styling@abdul778/page-editor@7qr.codes/qr@contember/admin@dbp-topics/greenlight@denodeland/qr-code-styling@diadal/vue3-qr-code-styling@digital-blueprint/greenlight-appyoteqi_qr_codezfinder-mw-directoryzfinder-mw-markdownvue3-qr-code-styled-componentvue3-qr-code-stylingvue3-qrcode-fixundirected-ordered-unchunked-qr-channelzk-types@fe-tools/vue-poster@h7ioo/styled-qr-code-node@hc-master/renderer@iden3/iden3@fusuma-ex/mdx-loader@fusuma/mdx-loader@getalby/bitcoin-connect@likecoin/qr-code-styling@loskir/styled-qr-code-node@mechamittens/extension@nano.gift/nano.js@nightlylabs/qr-code@nimashoghi/qr-code-styling@nixjs23n6/qrcode-react@eymric/qr-code@metaexplorer-mods/qr-code-genscan@mithrandirii/qr-code-styling@moh586/qr-code-vue3-dimobit@moh586/qrcode-generator-vue3@inverzio/styled-qr-code-canvas@izoukhai/qr-code-styling@izoukhai/qr-code-styling-v2@izoukhai/styled-qr-code-v2@jackybaby/react-custom-qrcode@joellord/react-qrcode-logo@jenea_vn/qr-code@kakapolabs/kakapolabels@ray-js/ty-outdoor-utils@salt5932/styled-qr-code-node-fix@sayduck/viewer-jellyfish@rjseibane/qrcode@polkadot/react-qr@pillowstudio/qr-code-styling@polkadot/ui-qr@polkadot-cloud/recipes@polkadot-ui/recipes@playbasis1/playbasis@oak-tree-house/vuepress-theme-vuetify-blog@orayya/pdf-generator
1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

10 years ago