C#: Online Guide
How To: Barcode Generator
ITF-14
ITF-14
  |  
Home ›› XImage.Barcode Generator ›› C# Barcode Generator: ITF-14

C# Imaging - Linear ITF-14 Barcode Generator


C# Code for ITF-14 Barcode Image Generation in .NET Application




C# Image - ITF-14 Barcode Creating Add-on Overview



ITF-14 Barcode Creator Add-on from RasterEdge DocImage SDK for .NET owns mature and advanced ITF-14 barcode drawing functions for C#.NET image processing and document manipulating applications. Our C#.NET ITF-14 barcode creating control is competitive on the market for generating 1D ITF-14 barcode on the supported image and document formats, such as Jpeg, Jbig2, Png, Gif, Bmp, TIFF, PDF, Word, Excel and PowerPoint. Specific benefit list of ITF-14 barcode generating in C# class is listed below.


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 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#
c# asp.net powerpoint document viewer: ASP.NET PowerPoint Document Viewer Control: view pptx files online in C# using ASP.NET


Support combining ITF-14 barcode generating component within C# program


Empower users with ITF-14 barcode creation on Jpeg, Png, Gif and Bmp images in C# class


Easy to change the value of ITF-14 barcode horizontal and vertical bearer bars


Adjust ITF-14 barcode size related properties, such as X & Y, barcode width & height and margin data


ITF-14 barcode library will automatically adjust barcode width and height to suitable value


Set X & Y to control barcode image area on PDF, TIFF, Word, Excel and PowerPoint pages


Available to customize ITF-14 barcode image fore and back colors in C#.NET project


Enable C#.NET users to print generated barcode image with high or low resolution




C# Code for Customizing ITF-14 Barcode Generation



You can easily generator ITF-14 barcode and save it  to image files/object using this C#.NET barcode generator control. The following steps will show how to create a ITF-14 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 ITF-14 barcode.




private static Linear CreateBarcode()
        {
            Linear barcode = new Linear();// create a barcode
            barcode.Type = BarcodeType.ITF14;// 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# Image - Create ITF-14 Barcode on Image File



This C#.NET barcode generator dll supports users generating & inserting ITF-14 barcode at specified area of Png, Gif, Jpeg and Bmp images by using C#.NET class code. In addition, users are able to set all ITF-14 barcode properties to generate a satisfactory ITF-14 barcode 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# Image - Create ITF-14 Barcode on Document File



Using this ITF-14 barcode creator add-on for C#.NET, users can select a page from multi-page document file and generate a standard ITF-14 barcode at a specified area of that selected page within C#.NET class application. The supported document files are PDF, TIFF, Word, Excel and PowerPoint. What's more, if you want to personalize ITF-14 barcode image, you are able to adjust the barcode parameters to your desired values. Main relative parameters include: ITF-14 bar module width & height, barcode width & height, multiple margin data, barcode fore & back color and font style.



C# Demo Code to Create ITF-14 in Certain PDF Page Area



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");
        }




Create ITF-14 Barcode in Specific TIFF Page in C#



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");
        }




Draw ITF-14 Barcode on Microsoft Word Document



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");
        }




Generate ITF-14 Barcode on Microsoft Excel Document



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");
        }




Draw ITF-14 Barcode on Microsoft PowerPoint Document



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");
        }





C# Image - Entire C# Code to Generate ITF-14 Barcode



Following C# sample code is used to generate a standard ITF-14 barcode on a png image file. From the C# code, you can find many ITF-14 barcode imaging-related parameters, which are free to be adjusted to meet your own ITF-14 barcoding requirement.




// 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.ITF14;// select barcode type
barcode.Data = "0123456789012";// set barcode data 

// ITF-14 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;

// ITF-14 unique settings
barcode.N = 2F;//set the ratio value of wide bar to narrow bar
barcode.BearerBarHori = 2;
barcode.BearerBarVert = 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");