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

C# Imaging - RM4SCC Barcode Generation Tutorial


C# Tutorial and Codes for Creating RM4SCC Barcode in C# Imaging Application




C# Imaging - RM4SCC 1D Barcode Add-on Overview



RM4SCC is a linear postal barcode symbology used by the Royal Mail for Cleanmail service. It is also known as CBC (Customer Bar Code) within Royal Mail. RasterEdge Barcode Creator Library Plug-in, a consisting DLL of DocImage SDK for .NET, is a .NET control developed for barcode writing in C#.NET applications. Users can use this barcode generator to print RM4SCC barcode on image files such png, jpeg, gif, and bmp images, along with documents like PDF, Microsoft Office Word (docx file), Excel, PowerPoint and (multi-page) TIFF.


Related .net document control helps:
asp.net pdf editor control: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net open pdf password control: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#
file annotation asp.net: ASP.NET Document Annotation Control: text comment, drawing on files online using ASP.NET component
asp.net tiff file viewer: ASP.NET Tiff Document Viewer: view, annotate Tiff files in HTML using C# Control
asp.net pdf file permission control: ASP.NET PDF File Permission Control: apply, remove PDF file permission settings in C#
asp.net pdf editor control: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net open pdf password control: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#


Detailed features are listed below:


Written in managed C# pure code, compatible with .NET Framework 2.0 and above


Support .NET development environments such as Microsoft Visual Studio 2005 & later versions


Easy to create a high-quality RM4SCC royal mail barcode using Visual C# code


Provide C# sample codes to resize RM4SCC linear barcode image


Free to adjust various RM4SCC parameters such as resolution, orientation, color, text font, etc.


Advanced algorithm to automatically add checksum digit to RM4SCC barcode




C# Code for Customizing RM4SCC Barcode Generation



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




private static Linear CreateBarcode()
        {
            Linear barcode = new Linear();// create a barcode
            barcode.Type = BarcodeType.RM4SCC;// select barcode type
            barcode.Data = "1234567ZC";// 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;
        }





Create RM4SCC Barcode on Image using C#



This C#.NET barcode generating control enables developers to write and print a RM4SCC bar code on a png, gif, jpeg or bmp image file. To get it started, you can simply open your MS Visual Studio and create a new C#.NET imaging project, such as a Windows application, and then add the RasterEdge.Imaging.Barcode.Creator.dll to your project reference. Now you can copy the C# sample codes to your program to draw a RM4SCC barcode on a sample png 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");
        }





Draw RM4SCC Barcode on Document with C#



This barcode generator add-on component for C#.NET can also help users draw a RM4SCC on a commonly used document, like PDF, (multi-page) TIFF, Microsoft Office Word, Excel and PPT. You can decide which page you want to put the barcode on, and which area you want to paint it. In addition, you can have full control over RM4SCC barcode settings, like size, color, rotation, resolution, UOM, and so on. Please refer to the parameter section for more details.



RM4SCC Generation in PDF Processing Application



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




RM4SCC Generation in TIFF Processing Application



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




RM4SCC Generation in Word Processing Application



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




RM4SCC Creation on MS PowerPoint Slide in C#.NET



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 AddBarcodeToImage(Linear barcode)
        {
            REImage image = new REImage(inputDirectory + "Sample.png");
            barcode.DrawBarcode(image, 150F, 150F);
            image.Save(ImageType.PNG, outputDirectory + "Sample_Barcode.png");
        }





Entire C# Code for RM4SCC Barcode Generation



The C# code below contains all the parameters mentioned above. Please use it to customize barcode properties so that you can generate a desired RM4SCC on a image or document file.




// 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.RM4SCC;// select barcode type
barcode.Data = "1234567ZC";// set barcode data 

// RM4SCC 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;

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