C#: Online Guide
How To: Barcode Generator
Leitcode
Leitcode
  |  
Home ›› XImage.Barcode Generator ›› C# Barcode Generator: Leitcode

C# Imaging - C# Leitcode Generator SDK Library


How to Insert Leitcode Barcode in C#.NET Imaging Project




C# Imaging - Leitcode Barcoding Add-On Overview



If you are trying to generate Leitcode on common image file formats, like PNG, GIF, BMP and JPEG; if you want to insert Leitcode barcode on common document files, like TIFF, PDF, Word, Excel and PowerPoint, then this C#.NET Barcode Creator Add-on of RasterEdge DocImage SDK for .NET will be a great choice for you. Using this Leitcode generating control, you are able to insert Leitcode barcode at any prescribed area or page of the supported image and document files.


Related .net document control helps:
asp.net dotnetnuke pdf editor using c#: ASP.NET DNN PDF Editor Control: view, edit PDF files in Dotnetnuke application
c# asp.net azure document viewer: ASP.NET Azure Document Viewer: view, annotate files online using ASP.NET Cloud Service
asp.net document viewer in c#: EdgeDoc ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online using ASP.NET Web Con...
asp.net edit pdf text using c#: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
c# asp.net document redaction: Redact document ASP.NET: add, delete, apply redaction on PDF files in web browser using C#.net
c# asp.net text document viewer: C# HTML5 Viewer: Load, View, Convert, Annotate and Edit OpenOffice, CSV and Text file
asp.net pdf file permission using c#: ASP.NET PDF File Permission Control: apply, remove PDF file permission settings in C#


Particular benefits on drawing Leitcode barcode in C#.NET project.


Provide complete barcoding APIs and functions for Leitcode generating in Visual C#.NET class


Easy to combine barcode drawing component within image processing and manipulation application in C#


Create Leitcode barcode on PNG, GIF, BMP, & JPEG images within a few seconds


Support resetting Leitcode parameters to desired creating status with C#.NET barcode writing library


Choose to create Leitcode barcode on specific TIFF, PDF, Word, Excel or PowerPoint document page


Resize Leitcode linear barcode image automatically in C#.NET class code


Flexible barcode setting support for creating color or black and white Leitcode barcode image in C#


Save image and document with inserted Leitcode barcode to local disk or memory




C# Code for Customizing Leitcode Barcode Generation



You can easily generator Leitcode barcode and save it  to image files/object using this C#.NET barcode generator control. The following steps will show how to create a Leitcode type barcode encoding numeric data text "0123456789012" into the image object with XImage.Barcode.Creator.


Add References


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.BarcodeCreator.dll


  System.Drawing.dll


Using Namespaces


  using System.Drawing;


  using RasterEdge.XImage.BarcodeCreator;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.



Please copy the sample code as follow to generator a Leitcode barcode.




private static Linear CreateBarcode()
        {
            Linear barcode = new Linear();// create a barcode
            barcode.Type = BarcodeType.LEITCODE;// select barcode type
            barcode.Data = "0123456789012";// set barcode data
            barcode.X = 1.0F;// set x
            barcode.Y = 60.0F;// set y
            barcode.Resolution = 96;// set resolution
            barcode.Rotate = Rotate.Rotate0;// set rotation
            barcode.BarcodeWidth = 200;
            barcode.BarcodeHeight = 200;
            barcode.AutoResize = true;

            //convert barcode to a bitmap and save it to image file
            //Bitmap bmp = barcode.ToImage();
            //bmp.Save(@"C:\barcode.bmp");

            return barcode;
        }





C# Imaging - Create Leitcode Barcode on Image Files



Using this Barcode Creator Add-on for C#.NET, developers and end users can easily integrate Leitcode barcode generating functions into your C#.NET image processing and managing application. The supported image types include PNG, GIF, BMP, and JPEG. What's more, we provide full barcode generating methods to customize Leitcode barcode and adjust the location of barcode on image.




private static void AddBarcodeToImage(Linear barcode)
        {
            REImage image = new REImage(inputDirectory + "Sample.png");
            barcode.DrawBarcode(image, 150F, 150F);
            image.Save(ImageType.PNG, outputDirectory + "Sample_Barcode.png");
        }





C# Imaging - Draw Leitcode Barcode on Document



This C#.NET barcode generator component can help you insert a Leitcode barcode on certain page of a document file like PDF, TIFF, Word, Excel and PowerPoint. Besides, with the application of location X and Y, this .NET barcode generator component can also help you specify the area where the Leitcode will be generated.



C# Code to Generate Leitcode Barcode on PDF



Add References(Extra)


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Using Namespace(Extra)


  RasterEdge.XDoc.PDF;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;



private static void AddBarcodeToPDF(Linear barcode)
        {
            PDFDocument docx = new PDFDocument(inputDirectory + "Sample.pdf");
            BasePage page = docx.GetPage(0);
            REImage image = new REImage(barcode.ToImage());
            page.AddImage(image, new PointF(100F, 100F));
            docx.Save(outputDirectory + "Sample_Barcode.pdf");
        }




C# Code to Insert Leitcode Barcode on Certain TIFF Page



Add References(Extra)


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.TIFF.dll


Using Namespace(Extra)


  RasterEdge.XDoc.TIFF;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




private static void AddBarcodeToTIFF(Linear barcode)
        {
            TIFFDocument docx = new TIFFDocument(inputDirectory + "Sample.tif");
            BasePage page = docx.GetPage(0);
            REImage image = new REImage(barcode.ToImage());
            page.AddImage(image, new PointF(100F, 100F));
            docx.Save(outputDirectory + "Sample_Barcode.tif");
        }




C# Code to Draw Leitcode on Specific Word Page Area



Add References(Extra)


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.Word;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




private static void AddBarcodeToWord(Linear barcode)
        {
            DOCXDocument docx = new DOCXDocument(inputDirectory + "Sample.docx");
            BasePage page = docx.GetPage(0);
            REImage image = new REImage(barcode.ToImage());
            page.AddImage(image, new PointF(100F, 100F));
            docx.Save(outputDirectory + "Sample_Barcode.docx");
        }




C# Code to Create Leitcode on Excel Document Page



Add References(Extra)


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.Excel;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




private static void AddBarcodeToExcel(Linear barcode)
        {
            XLSXDocument docx = new XLSXDocument(inputDirectory + "Sample.xlsx");
            BasePage page = docx.GetPage(0);
            REImage image = new REImage(barcode.ToImage());
            page.AddImage(image, new PointF(100F, 100F));
            docx.Save(outputDirectory + "Sample_Barcode.xlsx");
        }




C# Code to Generate Leitcode on PowerPoint Slide



Add References(Extra)


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.PowerPoint;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




private static void AddBarcodeToPowerPoint(Linear barcode)
        {
            PPTXDocument docx = new PPTXDocument(inputDirectory + "Sample.pptx");
            BasePage page = docx.GetPage(0);
            REImage image = new REImage(barcode.ToImage());
            page.AddImage(image, new PointF(100F, 100F));
            docx.Save(outputDirectory + "Sample_Barcode.pptx");
        }





Entire C# Code for Leitcode Barcode Generation



Following C# code illustrates how to generate a customized Leitcode on a PNG image file in .NET applications. Other supporting raster image formats are BMP, JPEG and GIF.




// create REImage on which you want to draw the barcode
REImage reImage = new REImage("c:/Sample.png");

Linear barcode = new Linear();// create a barcode
barcode.Type = BarcodeType.LEITCODE;// select barcode type
barcode.Data = "0123456789012";// set barcode data 

// Leitcode size settings
barcode.UOM = RasterEdge.Imaging.Barcode.Creator.UnitOfMeasure.PIXEL;
barcode.X = 2.0F;
barcode.Y = 80F;
barcode.BarcodeHeight = 120;
barcode.BarcodeWidth = 120;
barcode.BottomMargin = 20;
barcode.TopMargin = 20;
barcode.BottomMargin = 20;
barcode.LeftMargin = 20;
barcode.RightMargin = 20;
barcode.AutoResize = false;
barcode.BarAlignment = AlignmentHori.Center;

// Leitcode unique settings
barcode.N = 2;

// color related settings
barcode.BackColor = System.Drawing.Color.White;
barcode.ForeColor = System.Drawing.Color.Black;

// human-readable text related settings
barcode.ShowText = true;
barcode.TextFont = new Font("Arial", 9f, FontStyle.Regular);
barcode.TextMargin = 6F;
barcode.TextColor = System.Drawing.Color.Black;

// other related settings
barcode.Resolution = 96;
barcode.Rotate = Rotate.Rotate0;

barcode.DrawBarcode(reImage, 0, 0);// draw barcode on REImage with location x and y

reImage.Save(ImageType.PNG, @"c:/barcode.png");