pgqr
TypeScript icon, indicating that this package has built-in type declarations

1.3.15 • Public • Published

PGQR

A QR Code generator with full logo + svg support

Usage

npm install pgqr
import {PGQRCode} from 'pgqr';

const options = {
    errorCorrectionLevel: 'H',
    maskPattern: undefined,
    logoScale: 0.9,
    logoAreaScale: 1,
    dotRadius: 0.5,
    dotScale: 0.95,
    dotColor: 'black',
    outerEyeRadius: 0.5,
    outerEyeColor: 'black',
    innerEyeRadius: 0.5,
    innerEyeColor: 'black',
    backgroundColor: 'red'
}

const qr = new PGQRCode();

const svgString = await qr.renderSVG('https://example.com', options, '/logo.svg');

const pngBlob = await qr.toImage('https://example.com', options, '/logo.svg', 1024, 'png');

const jpgBlob = await qr.toImage('https://example.com', options, '/logo.svg', 1024, 'jpg');

const svgBlob = await qr.toSvg('https://example.com', options, '/logo.svg');

const pdfBlob = await qr.toPDF('https://example.com', options, '/logo.svg');

const zipBlob = await qr.toBatch(
  [
    {code: 'https://example.com', filename: 'qr1'},
    {code: 'https://example.com', filename: 'qr2'},
    {code: 'https://example.com', filename: 'qr3'},
  ],
  options,
  '/logo.svg',
  1024,
  formats: ['png', 'jpg', 'svg', 'pdf']
);

Road Map

  • More dot styles
    • Triangle, Diamond, Circle, Hexagon etc
    • Import custom SVG

Package Sidebar

Install

npm i pgqr

Weekly Downloads

34

Version

1.3.15

License

MIT

Unpacked Size

22.2 kB

Total Files

5

Last publish

Collaborators

  • petergilmour1987