C#: Online Guide
How To: Barcode Generator
Micro PDF 417
Micro PDF 417
  |  
Home ›› XImage.Barcode Generator ›› C# Barcode Generator: Micro PDF 417

C# Imaging - Micro PDF 417 C# Barcode Generation


How to Draw Micro PDF-417 on Image & Document Using C# Code




C# Imaging - Micro PDF 417 Barcoding Add-On Overview



The Barcode Creator Add-on of RasterEdge DocImage SDK for .NET is a reliable and robust barcode generating component written in managed C# code. Apart from the commonly used PDF-417 barcode, it also supports generating Micro PDF-417 barcode symbol, which is compatible with established ISO/IEC barcode specification and standard, in Visual C#.NET imaging applications. With this library, users will be able to create standalone barcode images on png, jpeg, gif, bmp, or simply insert barcodes on several documents, including TIFF, PDF, Word, Excel and PPTX.


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




C# Code for Customizing Micro PDF 417 Barcode Generation



You can easily generator Micro PDF 417 barcode and save it  to image files/object using this C#.NET barcode generator control. The following steps will show how to create a Micro PDF417 type barcode encoding numeric data text "123456789" 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 Micro PDF417 barcode.




        private static MicroPDF417 CreateBarcode()
        {
            MicroPDF417 barcode = new MicroPDF417();// create a Data Matrix barcode
            barcode.Data = "123456789";// encode data into Data Matrix barcode    
            barcode.X = 5.0F;// set module size
            // the minimum value for each margin should be equal to X
            barcode.RightMargin = barcode.LeftMargin = barcode.TopMargin = barcode.BottomMargin = barcode.X;
            barcode.Resolution = 96;// set barcode printing resolution   
            barcode.Rotate = Rotate.Rotate0;// set rotation
            barcode.BarcodeHeight = 200;
            barcode.BarcodeWidth = 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 Micro PDF 417 Barcode on Images



This Barcode Creator Add-on for .NET can be directly used in C#.NET image processing applications. It supports drawing Micro PDF 417 barcode on png, gif, jpeg & bmp image files. Demonstrated below is the C# sample coding with which you will create a Micro PDF 417 barcode encoding "123456789" on a png image "Sample.png" located in your hard drive C.


Demo setting only includes module width, image resolution, rotation / orientation, and the specific location for barcode printing on sample image. For more settings such as column count, row count, unit of measure (pixel, cm and inch), and barcode image color, please refer to the property table below to create custom Micro PDF 417.




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





C# Imaging - Insert Micro PDF 417 Barcode on Documents



Using this Barcode Creator Add-on for C#.NET, you are free to write and draw Micro PDF 417 barcode on PDF, TIFF, Microsoft Word, Excel and PowerPoint documents page in C#.NET class application. At the same time, you have full control for the exact location of barcode on image by simple settings of X and Y coordinates that are measured in pixel.



C# Code for Generating Micro PDF 417 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(MicroPDF417 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 for Creating Micro PDF 417 Barcode on TIFF



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(MicroPDF417 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 for Printing Micro PDF 417 Barcode on Word



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(MicroPDF417 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 on Adding 2D Micro PDF 417 to Excel



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(MicroPDF417 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 Create Micro PDF 417 on PPTX File



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