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
object
QRBill
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public static class QRBill

Fields

| Edit this page View Source

A4PortraitHeight

The height of an A4 sheet in portrait orientation. A4PortraitSheet

Declaration
public const double A4PortraitHeight = 297
Field Value
Type Description
double

The height, in mm.

| Edit this page View Source

A4PortraitWidth

The width of an A4 sheet in portrait orientation. A4PortraitSheet

Declaration
public const double A4PortraitWidth = 210
Field Value
Type Description
double

The width, in mm.

| Edit this page View Source

PaymentPartHeight

The height of the payment part, in mm. PaymentPartOnly

Declaration
public const double PaymentPartHeight = 105
Field Value
Type Description
double

The height, in mm.

| Edit this page View Source

PaymentPartWidth

The width of the payment part, in mm. PaymentPartOnly

Declaration
public const double PaymentPartWidth = 148
Field Value
Type Description
double

The width, in mm.

| Edit this page View Source

QrBillHeight

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

Declaration
public const double QrBillHeight = 105
Field Value
Type Description
double

The height, in mm.

| Edit this page View Source

QrBillWidth

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

Declaration
public const double QrBillWidth = 210
Field Value
Type Description
double

The width, in mm.

| Edit this page 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
double

The height, in mm.

| Edit this page 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
double

The width, in mm.

| Edit this page View Source

QrCodeHeight

The height of the QR code. QrCodeOnly

Declaration
public const double QrCodeHeight = 46
Field Value
Type Description
double

The height, in mm.

| Edit this page View Source

QrCodeWidth

The width of the QR code. QrCodeOnly

Declaration
public const double QrCodeWidth = 46
Field Value
Type Description
double

The width, in mm.

| Edit this page 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
double

The height, in mm.

| Edit this page 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
double

The width, in mm.

Properties

| Edit this page View Source

LibraryVersion

Gets the library's version number.

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

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

Methods

| Edit this page 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. If 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
string text

The text to decode.

Returns
Type Description
Bill

The decoded bill data.

Exceptions
Type Condition
QRBillValidationException

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

| Edit this page View Source

DecodeQrCodeText(string, bool)

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. If 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, bool allowInvalidAmount)
Parameters
Type Name Description
string text

The text to decode.

bool allowInvalidAmount

If true, invalid values for the amount are also accepted (currently "NULL" / "null"). In this case, the amount is set to null.

Returns
Type Description
Bill

The decoded bill data.

Exceptions
Type Condition
QRBillValidationException

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

| Edit this page 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.

| Edit this page View Source

DrawSeparators(SeparatorType, bool, 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.

bool withHorizontalLine
                             <pre><code class="lang-csharp">true</code></pre> if both the horizontal and vertical line should be drawn,
false
for the vertical line only
ICanvas canvas

The canvas to draw to.

| Edit this page 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
string

The text to embed in a QR code.

Exceptions
Type Condition
QRBillValidationException

The bill data is invalid.

| Edit this page 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
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)
| Edit this page 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.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX