Fit Barcode Into Size | C#ByteScout Barcode SDK

Fit Barcode Into Size | C#

Program.cs:

C#
using System.Diagnostics;
using Bytescout.BarCode;

namespace FitInto
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new barcode
            Barcode barcode = new Barcode();

            // Set symbology
            barcode.Symbology = SymbologyType.Code39;
            // Set value
            barcode.Value = "Sample";

            // Specify barcode size by bounds to fit into.
            // You can use any measure units.
            barcode.FitInto(5, 3, UnitOfMeasure.Inch);

            // Save barcode to image
            barcode.SaveImage("result.png");

            // Show image in default image viewer
            Process.Start("result.png");
        }
    }
}