manuelbl / SwissQRBill.NET

.NET library for Swiss QR bill payment slips (aka QR-Rechnung)
MIT License
88 stars 33 forks source link

QrCodeOnly with quiet zone #61

Closed EnraH closed 1 year ago

EnraH commented 2 years ago

Is it possible to generate a QrCode (QrCodeOnly without the entire payment slip) that has a quite zone (white margin) around it? If not, would it be possible to add such a feature?

manuelbl commented 2 years ago

You can generate the QR code only, but it indeed has no quite zone.

Can you describe the use case in more detail? In what context will the QR code be used? What graphics format are you using?

EnraH commented 2 years ago

Thank you for the immediate reply. We're embedding the QR Code in HTML that might be rendered in dark mode. Without the quiet zone the QrCode cannot be scanned properly. We're using both png and svg.

manuelbl commented 2 years ago

This might be a valuable addition. How big should the quite zone be? I'm considering several options:

  1. Minimum as required by standard, i.e. a width of four modules (modules are the "pixels" of a QR code). Thus the effective width would depend on the QR code content: longer content -> smaller modules -> smaller quiet zone.
  2. Fixed width of 5mm: A fixed width is visually more consistent. 5mm will always be sufficient.
  3. Configurable width: The width can be configured but is independent of the module size.

I'm leaning towards option 2 as it visually consistent and doesn't need additional configuration (which increases complexity for users of the library).

EnraH commented 2 years ago

Your considerations sound reasonable to me. If configurability is regarded as useful, it may still be added later on.

manuelbl commented 1 year ago

A new output size has been added in version 3.0.6: QrCodeWithQuietZone

See https://codecrete.net/SwissQRBill.NET/api/Codecrete.SwissQRBill.Generator.OutputSize.html#fields

EnraH commented 1 year ago

Thank you very much for the prompt implementation.