Skip to content

Latest commit

 

History

History
200 lines (120 loc) · 3.99 KB

index.md

File metadata and controls

200 lines (120 loc) · 3.99 KB

Index


Classes

Class: SwissQRBill

Defined in: src/svg/swissqrbill.ts

Description

The SwissQRBill class creates the Payment Part with the QR Code as an SVG.

Example

const data = {
  amount: 1994.75,
  creditor: {
    account: "CH44 3199 9123 0008 8901 2",
    address: "Musterstrasse",
    buildingNumber: 7,
    city: "Musterstadt",
    country: "CH",
    name: "SwissQRBill",
    zip: 1234
  },
  currency: "CHF",
  debtor: {
    address: "Musterstrasse",
    buildingNumber: 1,
    city: "Musterstadt",
    country: "CH",
    name: "Peter Muster",
    zip: 1234
  },
  reference: "21 00000 00003 13947 14300 09017"
};

const svg = new SwissQRBill(data);
writeFileSync("qr-bill.svg", svg.toString());

Constructor: new SwissQRBill(data[, options])

Defined in: src/svg/swissqrbill.ts

Parameters
Return Type

SwissQRBill


Property: SwissQRBill.instance

public

Defined in: src/svg/swissqrbill.ts

Type

SVG


Method: SwissQRBill.toString()

public

Defined in: src/svg/swissqrbill.ts

Return Type

string The outerHTML of the SVG.

Description

Outputs the SVG as a string.


Getter: SwissQRBill.element()

public

Defined in: src/svg/swissqrbill.ts

Return Type

SVGElement The SVG element.

Description

Returns the SVG element.


Class: SwissQRCode

Defined in: src/svg/swissqrcode.ts


Constructor: new SwissQRCode(data[, size])

Defined in: src/svg/swissqrcode.ts

Parameters
  • data Data The data to be encoded in the QR code.
  • size number The size of the QR code in mm. optional Default: 46
Return Type

SwissQRCode

Throws
  • ValidationError Throws an error if the data is invalid.
Description

Creates a Swiss QR Code.


Property: SwissQRCode.instance

public

Defined in: src/svg/swissqrcode.ts

Type

SVG


Method: SwissQRCode.toString()

public

Defined in: src/svg/swissqrcode.ts

Return Type

string The outerHTML of the SVG element.

Description

Outputs the SVG as a string.


Getter: SwissQRCode.element()

public

Defined in: src/svg/swissqrcode.ts

Return Type

SVGElement The SVG element.

Description

Returns the SVG element.