Our Customers
Contact Us Email: support@barcodelib.com
Home > Java Barcode Generator > Java Barcode Generation Guide > Java RM4SCC Barcode Generator
Download Barcode for Java Trial

Java RM4SCC Barcodes Generator Guide

British Royal Mail 4-State Customer Bar Code Generation Guide in Java class, J2EE, Jasper Reports, iReport & Eclipse BIRT
  • Easily generate RM4SCC barcodes in Java applications
  • Generate high quality RM4SCC images in JPEG, GIF & PNG formats
  • 100% build in Java, compatible with JDK 1.4 and later version
  • Generate RM4SCC barcodes on any applications and platforms with Java virtual machine installed
  • Generate RM4SCC in Jasper Reports & iReport
  • Generate RM4SCC in Eclipse BIRT
  • Professional Java Barcode Generator library which enjoys customer appreciation for more than 10 years
  • Royalty-free developer license, one time purchase for lifetime use
RM4SCC Barcode Introduction
RM4SCC is also known as RM4SCC, RoyalMail4SCC, British Royal Mail 4-State Customer Code and Royal Mail Barcode
This Symbology is used by Royal Mail (United Kingdom) post office, Singapore post office for Postal code and automatic mail sorting.It provides information about the address of the receiver.
It encodes alpha-numeric characters (0-9, A-Z), as well as start and stop bar characters. It comprises four types of bars (the four states), each of which has a distinct name, value and barcode symbol.

4-State Barcode Bars
RM4SCC Encoding Data Scope
RM4SCC Barcode for Java supports:
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • A - Z
How to Generate RM4SCC Barcode in Java Class?
The following Java code illustrates how to create a RM4SCC barcode, and output to various formats.
1     Linear linear = new Linear(); 
2 linear.setType(Linear.RM4SCC);
3 linear.setData("ABC123");
4 linear.renderBarcode("c:/barcode.gif");

5 BufferedImage bufferedImage = linear.renderBarcode();

6 byte[] barcodeBytes = linear.renderBarcodeToBytes();

7 Graphics2D g = ...
8 Rectangle2D rectangle = ...
9 linear.renderBarcode(g, rectangle);

10 OutputStream outputStream = ...
11 linear.renderBarcode(outputStream);
  • Create a Linear barcode object (line 1)
  • Set Linear object barcode type to RM4SCC (line 2)
  • Set RM4SCC barcode data to encode (line 3)
  • Encode generated RM4SCC barcode into gif image file (line 4)
  • Generate RM4SCC and output to BufferedImage object (line 5)
  • Generate RM4SCC in bitmap and output to byte[] (line 6)
  • Generate RM4SCC and draw to defined area (Rectangle2D) on Graphics2D (line 7-9)
  • Generate RM4SCC and output to OutputStream (line 10-11)
How to Generate RM4SCC Barcode Image in Java Web Applications?
There are two methods to create RM4SCC barcode images in your Java web applications.
  1. The simplest way is to stream barcode image using our buildin barcode servlet application.
    • Download the Barcode for Java Trial Package, and unzip it.
    • Under java_barcode_trial package, copy barcode folder to your java servlet container like tomcat.
    • Restart tomcat. Now you have installed successfully.
    • To test your installation, open your web browser and navigate to:
      http://YourDomain:Port/barcode/linear?Data=ABC123&Type=RM4SCC
    • To create barcode image in your JSP or html page, you need pass the url to IMG tag src value. For example,
      <img src="http://YourDomain:Port/barcode/linear?Data=ABC123&Type=RM4SCC" />
      Using this method, it will not generate any barcode images in your server side.
  2. The second method is to generate barcode images in your server side.
    • Create a barcode image in server side, like
      Linear linear = new Linear();
      linear.setData("ABC123");
      linear.setType(Linear.RM4SCC);
      linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/barcode-images/barcode.gif");
    • In your JSP or HTML page, you need use IMG tag to display generated image, like
      <img src="http://YourDomain:Port/YourWebApp/barcode-images/barcode.gif" />
How to Generate Barcode RM4SCC Image in Jasper Reports, iReport, Eclipse BIRT?
RM4SCC Barcode Property Settings
  1. Set the type property to Linear.RM4SCC
    Servlet URL Parameter: "Type". Value: 39. Sample: &Type=39.
  2. Set the data property with the value to encode. Type is String.
    Servlet URL Parameter: Data.
    • Valid Data Scope:
      • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
      • uppercase letters (A through Z)
    • Sample: "ABC123".
  3. addCheckSum property is not applied. Barcode Library will automatically add one check character.
  4. Barcode image size settings.
    • Set property uom (Unit of Measure) for properties X, Y, leftMargin, rightMargin, topMargin and bottomMargin.
      Default is Linear.UOM_PIXEL (0). Valid values are Linear.UOM_PIXEL (0), Linear.UOM_CM (1), Linear.UOM_Inch (2).
      Servlet URL Parameter: "UOM". Value: 0 (pixel), 1 (cm), 2 (inch). Sample: &UOM=0.
    • Set the X (for barcode module width) and Y (for barcode module height) properties.
      Both types are float. Default X is 3. Y is 75.
      Servlet URL Parameter: "X", "Y". Sample: &X=3&Y=75.
    • Set the leftMargin, rightMargin, topMargin and bottomMargin properties, and types are all float.
      Default values are 0 for all 4 margin settings.
      Servlet URL Parameter: "LeftMargin", "RightMargin", "TopMargin", "BottomMargin". Sample: &LeftMargin=0.
    • Set the resolution property (Value is expressed in DPI - Dots per inch).
      Default is 72 dpi.
      Servlet URL Parameter: "Resolution". Sample: &Resolution=72.
  5. Setting up text style in barcode image.
    • Set the showText properties. If this value is true, barcode data will be displayed with the barcode.
      Default is true.
      Servlet URL Parameter: "ShowText". Value: "t" (true), "f" (false). Sample: &ShowText=t.
    • Set the textFont property. The font used to display text in barcode image.
      Default is new Font("Arial", Font.PLAIN, 11).
      Servlet URL Parameter: "TextFont". Value format: [font name]|[font style]|[font size]. Sample Values: &TextFont=Arial|Bold|12
  6. With rotate property, you can display barcode horizontally or vertically.
    Default value is 0.
    Servlet URL Parameter: "Rotate". Sample: &Rotate=0.
    Value can be:
    • 0 (Linear.ANGLE_0),
    • 1 (Linear.ANGLE_90),
    • 2 (Linear.ANGLE_180),
    • 3 (Linear.ANGLE_270).
How to Set Generated RM4SCC Barcode Image Size?

All Java Barcode Types/Symbologies

Encode Linear Barcodes:
Encode Matrix Barcodes: