The code sample shows how to create a Mailmark barcode in Java using the com.java4less.mailmark.Barcode class. It sets properties like size, symbology, item ID, format class, postcode, version ID, and supply chain ID on the barcode object. It then encodes the barcode to a JPEG image file using the ImageEncoder class. The document also describes the various formatting and Mailmark properties that can be set on the barcode.
The code sample shows how to create a Mailmark barcode in Java using the com.java4less.mailmark.Barcode class. It sets properties like size, symbology, item ID, format class, postcode, version ID, and supply chain ID on the barcode object. It then encodes the barcode to a JPEG image file using the ImageEncoder class. The document also describes the various formatting and Mailmark properties that can be set on the barcode.
The code sample shows how to create a Mailmark barcode in Java using the com.java4less.mailmark.Barcode class. It sets properties like size, symbology, item ID, format class, postcode, version ID, and supply chain ID on the barcode object. It then encodes the barcode to a JPEG image file using the ImageEncoder class. The document also describes the various formatting and Mailmark properties that can be set on the barcode.
The code sample shows how to create a Mailmark barcode in Java using the com.java4less.mailmark.Barcode class. It sets properties like size, symbology, item ID, format class, postcode, version ID, and supply chain ID on the barcode object. It then encodes the barcode to a JPEG image file using the ImageEncoder class. The document also describes the various formatting and Mailmark properties that can be set on the barcode.
barcode.setSize(300,300); // set size barcode.setSymbology(Barcode.BARCODE_C); barcode.setFormat("1"); barcode.setItemId("16563762"); barcode.setfClass("0"); barcode.setPostCodePlusDPS("EF61AH8T "); barcode.setVersionId("1"); barcode.setSupplyChainId("38"); ImageEncoder be= new ImageEncoder(barcode,"JPEG","barcode.jpg");
} }
the com.java4less.mailmark.Barcode is the main class for the barcode creating.
The formatting properties are: • Symbology: it can be Barcode.BARCODE_C or Barcode.BARCODE_L. • LeftMargin: selfexplaining (in pixels, (default is 30). • TopMargin: selfexplaining (in pixels,(default is 30). • BackColor: background color (default is white). • BarSpacing: pixels between bars (default is 2). • BarHeight: height of bars in pixels (default is 8). • ExtendedBarHeight: full bar height (default is 20). • QuiteZone: pixels between barcode and text (default is 10). • BarWidth: width of bars in pixels (default is 2). • UserTextBottom: text below the barcode. • UserTextTop: text above the barcode. • BarColor: bars color (default is black). • FontColor: user text color (default is black). • TextFont: font for user text.
Properties related to Mailmark:
• Format: value between 0 and 4. • ItemID: an eight digit string. • fClass: a single character between 0 and E (14 in Hexadecimal) • PostCodePlus DPS: a nine character string. ◦ The value “XY11 “ shall be used for international destinations. ◦ Or a pattern of characters for domestic codes (utward postcode, an inward postcode, and a Delivery Point Suffix). • VersionId: always 1. • SupplyChainID: ◦ for symbology C a 2 digit string value between 00 and 99 ◦ for symbology L a 6 digit string value between 000000 and 999999 Methods: • paint(Graphics g): use this method for paining onto a graphics object • setSize(width, height): sets the size of the output image in pixels. This method must be called before paint().