This simple topic will teach you how to convert Barcode to SVG in C# by providing details about configuring the environment and using different classes and functions to perform the task. A runnable example code is presented that can generate Barcode SVG image in C# using a very simple API interface and having no dependency on any other third-party software or application.
Steps to Generate Barcode SVG Image in C#
- Establish the environment to add Aspose.BarCode using the NuGet Package Manager
- Include the required namespaces in the program
- Instantiate the BarCodeGenerator class object by setting EncodeType 128 and adding the barcode text
- Save the generated Barcode as SVG on the disk
By using the aforementioned steps in C# SVG Barcode generator application can be developed using a few lines of code. We will commence the process by instantiating an object of the BarCodeGenerator class to create a simple barcode with encoding type 128 along with sample text. In the final steps, the generated Barcode is saved as an SVG file on the disk.
Code to Convert Barcode to SVG in C#
The above example in C# convert Barcode to SVG by setting the encoding type 128. The EncodeTypes enumerator contains many other encodings including EAN-13 and EAN-8, ITF-14, Code39, QR Code, GS1 Code, and others. This is fairly a simple code, but you can set a lot of other properties for the Barcode like adjusting its appearance in terms of size, resolution, border settings, rotation angle, and paddings.
In this short tutorial, we have learned to generate SVG Barcode using C#. If you are interested in learning about reading the Barcode, refer to the article on how to read Barcode using C#.