Link Search Menu Expand Document

Composed Barcode - C#

BarCode SDK sample in C# demonstrating ‘Composed Barcode’

Program.cs
using System.Diagnostics;
using Bytescout.BarCode;
using System.Drawing;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Result file
            var resultFile = "result.png";

            using (Barcode barcode = new Barcode("demo", "demo"))
            {
                barcode.Symbology = SymbologyType.Code128;

                barcode.Margins = new Margins(0, 0, 0, 0);
                barcode.DrawQuietZones = false;

                barcode.Value = "123123";
                Image image1 = barcode.GetImage();

                barcode.Value = "123";
                Image image2 = barcode.GetImage();

                using (ImageComposer composer = new ImageComposer(innerGap: 10, margins: 5, compositionMode: CompositionMode.ArrangeHorizontally))
                {
                    composer.AddImage(image1);
                    composer.AddImage(image2, 0, 0, rotationAngle: 90);

                    composer.SaveComposedImage(resultFile);
                }
            }

            // Open output file
            Process.Start(resultFile);
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore BarCode SDK


Copyright © 2016 - 2021 ByteScout