Skip to content
Raffael Herrmann edited this page May 8, 2017 · 13 revisions

QRCoder Logo

  1. What is QRCoder?
  2. What can and can't QRCoder do for you?
  3. On which systems is QRCoder available?
  4. How does QRCoder's architecture look?
  5. What makes QRCoder special?

What is QRCoder?

QRCoder is a .NET library, completely written in C#, which enables you to generate QR Codes as defined by ISO/IEC 18004. The main target of the QRCoder library is to deliver a small and easy to use solution, which has no dependencies to other libraries or network stacks. (Like QR Code generators which are relying on online services which makes them vulnerable.)

Although simplicity is one of the main goals, QRCoder is really flexible - in Output Formats as well as in Payload types. Payload types? Yes, QRCoder brings its own Payload Generator, which helps you to create a big list of different payload types to generate special codes like "WiFi QR Codes", "Girocodes", "SwissQRCodes" and many more.

What can and can't QRCoder do for you?

To put it in a nutshell - QRCoder can generate QR Codes but it can't read them. Its strength lays in the generation of QR Codes in many different ways. So if you want to show QR Codes in your mobiel app, business application, print them on invoices, show them on your website, ... then QR Coder suits your needs. But if you want to create a QR Code reader, than you should use another library.

On which systems is QRCoder available?

Since QRCoder is written in C#.NET it runs - in the first place - on every platform which supports the .NET-Framework. The Nuget-Packages contain different versions (.NET 4.0, .NET 3.5 and .NET Standard) binaries, so that it supports multiple platforms.

Unfortunately we have to admit, that it comes to some constraints when using the .NET Standard version. Since this PCL library version has to run on a bunch of different systems and not every of this systems supports the full System.Drawing stack, we had to remove some of the QRCoder output types. But if you keep this in mind, this won't stop you to get the same results as in the full version. (You only have to write some more lines of platform dependend code.)

As of now we know from projects in C# Winforms, C# WPF, ASP.NET, Mono on Linux, .NET Core on Ubuntu, Unity on Android and Microsoft Office VBA which use QrCoder for their QR Code generation.

How does QRCoder's architecture look?

To understand QRCoder's architecture we have to look at the structure of QR Codes at first. A QR Code is a code which consists of black and white blocks, the so called "modules". The modules represent the data (=payload), which was encoded into the QR Code, as also some additional information about QR Code version, format, etc. So what has this todo with QRCoder's architecture?

In QRCoder we separated the data (and QR Code generator) logic from the represenation logic.

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("my payload to be encoded");

The example above represents the data logic. By calling the CreateQrCode-function the payload will be encoded as QR Code and returned to the QRCodeData-object named qrCodeData. This data object contains the information about all the modules - e.g. first row, first column = black, first row, second column = white, ... and so on.

Now you could write your own renderer to make an image out of this information. This gives you 100% flexibility. You want circles instead of squares? Draw the information as circles. You want the modules to be opaque? Draw ...

If you don't like flexibility or just want to get fast results, don't panic. For this case we implemented the represenation logic, which is a set of different classes (also called renderers) which take the QrCodeData and output the QR Code in your favourite file format.

At the moment the following renderers are implemented:

  • QRCode (Returns a Bitmap object which can be saved as .bmp, .jpg, .png, .gif, ...)
  • Base64QRCode (Returns the QR Code as Base64 image which can be embedded in websites, etc.)
  • BitmapByteQRCode (Returns a Byte-Array which contains a Bitmap. This works as best on platforms which don't support System.Drawing)
  • SvgQRCode (Returns a String which contains the QR Code as SVG vector graphic)
  • UnityQRCode (Returns a Texture2D object for usage in Unity projects)

We would be proud to see your renderer in this list, too. So feel free to write a new renderer and contribute it to this project.

What makes QRCoder special?

Let us just list some points:

  • Single .dll solution
  • Multi-platform (through .NET 3.5, .NET 4.0 and PCL versions)
  • Multiple output formats (see the paragraph about renderers above)
  • Massive payload generator which support a lot of special payload types