Search in sources :

Example 36 with BarCodeBuilder

use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.

the class CreatingAnAztecBarcode method errorCorrection.

public static void errorCorrection(String dataDir) throws IOException {
    BarCodeBuilder b = new BarCodeBuilder();
    b.setEncodeType(com.aspose.barcode.EncodeTypes.AZTEC);
    b.setAztectErrorLevel(50);
    b.setCodeText("1234567890");
    b.save(dataDir + "error_correction_aztec.bmp", BarCodeImageFormat.Bmp);
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 37 with BarCodeBuilder

use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.

the class Checksum method main.

public static void main(String[] args) {
    // The path to the resource directory.
    String dataDir = Utils.getDataDir(Checksum.class) + "Barcode/AdvancedFeatures/";
    BarCodeBuilder bb = new BarCodeBuilder();
    bb.setCodeText("1234567");
    bb.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_39_STANDARD);
    // Make the checksum to be visible on the barcode
    bb.setEnableChecksum(EnableChecksum.Default);
    // Save the Barcode image to file
    bb.save(dataDir + "checksum.jpg");
}
Also used : EnableChecksum(com.aspose.barcode.EnableChecksum) BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 38 with BarCodeBuilder

use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.

the class GenerateAPatchCode method generateWholePage.

public static void generateWholePage() throws IOException {
    BarCodeBuilder builder = new BarCodeBuilder("Patch T", com.aspose.barcode.EncodeTypes.PATCH_CODE);
    // in millimeters
    builder.setImageWidth(150);
    // make the same small margins
    builder.setMargins(new MarginsF(0.5f, 0.5f, 0.5f, 0.5f));
    // to hide codetext
    builder.setCodeLocation(CodeLocation.None);
    BufferedImage topImg = builder.generateBarCodeImage();
    builder.rotate(90);
    BufferedImage leftImg = builder.generateBarCodeImage();
    builder.rotate(90);
    BufferedImage bottomImg = builder.generateBarCodeImage();
    builder.rotate(90);
    BufferedImage rigthtImg = builder.generateBarCodeImage();
    BufferedImage frameImg = new BufferedImage(topImg.getWidth(), rigthtImg.getHeight() + 2 * topImg.getHeight(), rigthtImg.getType());
    // Initialize graphics object from the image
    Graphics graphics = frameImg.getGraphics();
    graphics.drawImage(topImg, 0, 0, null);
    graphics.drawImage(leftImg, 0, topImg.getHeight(), null);
    graphics.drawImage(bottomImg, 0, topImg.getHeight() + leftImg.getHeight(), null);
    graphics.drawImage(rigthtImg, topImg.getWidth() - rigthtImg.getWidth(), topImg.getHeight(), null);
    // save Patch code frame
    File outputfile = new File(Utils.getDataDir(GenerateAPatchCode.class) + "Barcode/AdvancedFeatures/" + "patch-code-frame.png");
    ImageIO.write(frameImg, "png", outputfile);
}
Also used : Graphics(java.awt.Graphics) BarCodeBuilder(com.aspose.barcode.BarCodeBuilder) MarginsF(com.aspose.barcode.MarginsF) File(java.io.File) BufferedImage(java.awt.image.BufferedImage)

Example 39 with BarCodeBuilder

use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.

the class GenerateAPatchCode method generatePatchCode.

public static void generatePatchCode() {
    // The path to the resource directory.
    String dataDir = Utils.getDataDir(GenerateAPatchCode.class) + "Barcode/AdvancedFeatures/";
    BarCodeBuilder builder = new BarCodeBuilder();
    // set Symbology type
    builder.setEncodeType(com.aspose.barcode.EncodeTypes.PATCH_CODE);
    builder.setCodeText("Patch T");
    builder.save(dataDir + "patch.bmp");
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 40 with BarCodeBuilder

use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.

the class GenerateAustraliaPostBarcode method main.

public static void main(String[] args) {
    // The path to the resource directory.
    String dataDir = Utils.getDataDir(GenerateAustraliaPostBarcode.class) + "Barcode/AdvancedFeatures/";
    // Create instance of BarCodeBuilder, specify code-text and Symbology in the constructor
    BarCodeBuilder builder = new BarCodeBuilder("1234567890", com.aspose.barcode.EncodeTypes.AUSTRALIA_POST);
    // Save the image to disk in PNG format
    builder.save(dataDir + "australiaPostBarcode.png");
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Aggregations

BarCodeBuilder (com.aspose.barcode.BarCodeBuilder)56 BufferedImage (java.awt.image.BufferedImage)4 File (java.io.File)3 MarginsF (com.aspose.barcode.MarginsF)2 Font (java.awt.Font)2 Graphics (java.awt.Graphics)2 Image (java.awt.Image)2 Caption (com.aspose.barcode.Caption)1 EnableChecksum (com.aspose.barcode.EnableChecksum)1 Resolution (com.aspose.barcode.Resolution)1 BarCodeReader (com.aspose.barcode.barcoderecognition.BarCodeReader)1 MediaTracker (java.awt.MediaTracker)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1