Show / Hide Table of Contents

Class QRBill

Generates Swiss QR bill payment part.

Can also validate the bill data and encode and decode the text embedded in the QR code.

Inheritance
System.Object
QRBill
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public static class QRBill

Fields

| Improve this Doc View Source

A4PortraitHeight

The height of an A4 sheet in portrait orientation. A4PortraitSheet

Declaration
public const double A4PortraitHeight = 297
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

A4PortraitWidth

The width of an A4 sheet in portrait orientation. A4PortraitSheet

Declaration
public const double A4PortraitWidth = 210
Field Value
Type Description
System.Double

The width, in mm.

| Improve this Doc View Source

PaymentPartHeight

The height of the payment part, in mm. PaymentPartOnly

Declaration
public const double PaymentPartHeight = 105
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

PaymentPartWidth

The width of the payment part, in mm. PaymentPartOnly

Declaration
public const double PaymentPartWidth = 148
Field Value
Type Description
System.Double

The width, in mm.

| Improve this Doc View Source

QrBillHeight

The height of a QR bill (payment part and receipt). QrBillOnly

Declaration
public const double QrBillHeight = 105
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

QrBillWidth

The width of a QR bill (payment part and receipt). QrBillOnly

Declaration
public const double QrBillWidth = 210
Field Value
Type Description
System.Double

The width, in mm.

| Improve this Doc View Source

QrBillWithHoriLineHeight

The height of a the output format with extra space for horizontal separator line (payment part and receipt plus space for line and scissors). QrBillExtraSpace

Declaration
public const double QrBillWithHoriLineHeight = 110
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

QrBillWithHoriLineWidth

The width of the output format with extra space for horizontal separator line (payment part and receipt plus space for line and scissors). QrBillExtraSpace

Declaration
public const double QrBillWithHoriLineWidth = 210
Field Value
Type Description
System.Double

The width, in mm.

| Improve this Doc View Source

QrCodeHeight

The height of the QR code. QrCodeOnly

Declaration
public const double QrCodeHeight = 46
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

QrCodeWidth

The width of the QR code. QrCodeOnly

Declaration
public const double QrCodeWidth = 46
Field Value
Type Description
System.Double

The width, in mm.

| Improve this Doc View Source

QrCodeWithQuietZoneHeight

The height of the QR code with quiet zone, in mm. QrCodeWithQuietZone

Declaration
public const double QrCodeWithQuietZoneHeight = 56
Field Value
Type Description
System.Double

The height, in mm.

| Improve this Doc View Source

QrCodeWithQuietZoneWidth

The width of the QR code with quiet zone, in mm. QrCodeWithQuietZone

Declaration
public const double QrCodeWithQuietZoneWidth = 56
Field Value
Type Description
System.Double

The width, in mm.

Properties

| Improve this Doc View Source

LibraryVersion

Gets the library's version number.

Declaration
public static string LibraryVersion { get; }
Property Value
Type Description
System.String

version number in semantic versioning format (major.minor.patch)

Methods

| Improve this Doc View Source

DecodeQrCodeText(String)

Decodes the text from a QR code and fills it into a Bill data structure

A subset of the validations related to embedded QR code text is run. It the validation fails, a QRBillValidationException is thrown containing the validation result. See the error messages marked with a dagger in Bill data validation.

Declaration
public static Bill DecodeQrCodeText(string text)
Parameters
Type Name Description
System.String text

The text to decode.

Returns
Type Description
Bill

The decoded bill data.

Exceptions
Type Condition
QRBillValidationException

If he text could not be decoded or the decoded bill data is invalid.

| Improve this Doc View Source

Draw(Bill, ICanvas)

Draws the QR bill (payment part and receipt) or QR code for the specified bill data onto the specified canvas.

The QR bill or code are drawn at position (0, 0) extending to the top and to the right. Typically, the position (0, 0) is the bottom left corner of the canvas.

This methods ignores the formatting properties bill.Format.FontFamily and bill.Format.GraphicsFormat. They can be set when the canvas instance passed to this method is created.

If the bill data is not valid, a QRBillValidationException is thrown, containing the validation result. For details about the validation result, see Bill data validation.

Declaration
public static void Draw(Bill bill, ICanvas canvas)
Parameters
Type Name Description
Bill bill

The data for the bill.

ICanvas canvas

The canvas to draw to.

Exceptions
Type Condition
QRBillValidationException

The bill data is invalid.

| Improve this Doc View Source

DrawSeparators(SeparatorType, Boolean, ICanvas)

Draws the separator line(s) to the specified canvas.

The separator lines are drawn assuming that the QR bill starts at position (0, 0) and extends the top and right.So position (0, 0) should be in the bottom left corner.

This method allows to add separator lines to an existing QR bill, e.g. on to an archived QR bill document.

Declaration
public static void DrawSeparators(SeparatorType separatorType, bool withHorizontalLine, ICanvas canvas)
Parameters
Type Name Description
SeparatorType separatorType

The separator type.

System.Boolean withHorizontalLine
true
if both the horizontal and vertical line should be drawn,
false
for the vertical line only
ICanvas canvas

The canvas to draw to.

| Improve this Doc View Source

EncodeQrCodeText(Bill)

Encodes the QR bill data as a text to be embedded in a QR code.

The specified bill data is first validated and cleaned.

If the bill data is invalid, a QRBillValidationException is thrown, containing the validation result. For details about the validation result, see Bill data validation

Declaration
public static string EncodeQrCodeText(Bill bill)
Parameters
Type Name Description
Bill bill

The bill data to encode.

Returns
Type Description
System.String

The text to embed in a QR code.

Exceptions
Type Condition
QRBillValidationException

The bill data is invalid.

| Improve this Doc View Source

Generate(Bill)

Generates a QR bill (payment part and receipt) or QR code as an SVG image or PDF document.

If the bill is not valid, a QRBillValidationException is thrown, containing the validation result. For details about the validation result, see Bill data validation

The graphics format is specified in bill.Format.GraphicsFormat.

Declaration
public static byte[] Generate(Bill bill)
Parameters
Type Name Description
Bill bill

The data for the bill.

Returns
Type Description
System.Byte[]

The generated QR bill (as a byte array in the specified graphics format).

Exceptions
Type Condition
QRBillValidationException

The bill data is invalid.

See Also
Draw(Bill, ICanvas)
| Improve this Doc View Source

Validate(Bill)

Validates and cleans the bill data.

The validation result contains the error and warning messages (if any) and the cleaned bill data.

For details about the validation result, see Bill data validation

Declaration
public static ValidationResult Validate(Bill bill)
Parameters
Type Name Description
Bill bill

The bill data to validate.

Returns
Type Description
ValidationResult

The validation result.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX