Search in sources :

Example 46 with BarCodeBuilder

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

the class SpecifySymbology method main.

public static void main(String[] args) {
    // The path to the resource directory.
    String dataDir = Utils.getDataDir(SpecifySymbology.class) + "Barcode/BasicFeatures/";
    // Generate and save the image to file
    BarCodeBuilder builder = new BarCodeBuilder();
    // Set code text
    builder.setCodeText("test-123");
    // Set Symbology type
    builder.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_39_STANDARD);
    builder.save(dataDir + "Code39Standard.jpg");
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 47 with BarCodeBuilder

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

the class CreatingTwoDimensional2DBarcode method creatingADataMatrixBarcode.

public static void creatingADataMatrixBarcode(String dataDir) {
    BarCodeBuilder b = new BarCodeBuilder();
    b.setEncodeType(com.aspose.barcode.EncodeTypes.DATA_MATRIX);
    // Width of each module
    b.setxDimension(0.6f);
    b.setCodeText("123456789");
    b.save(dataDir + "datamatrix.bmp");
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 48 with BarCodeBuilder

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

the class GenerateMultipleMacroPdf417 method main.

public static void main(String[] args) {
    String dataDir = Utils.getDataDir(GenerateMultipleMacroPdf417.class) + "2DBarcode/UtilityFeatures/";
    BarCodeBuilder builder = new BarCodeBuilder();
    builder.setEncodeType(com.aspose.barcode.EncodeTypes.MACRO_PDF_417);
    // Create array for storing multiple barcodes
    int nSize = 4;
    String[] lstCodeText = new String[] { "code-1", "code-2", "code-3", "code-last" };
    String strFileID = "1";
    // Check the listbox for getting codetext and generating the barcodes
    for (int nCount = 1; nCount <= nSize; nCount++) {
        builder.setCodeText(lstCodeText[nCount - 1]);
        // fileID should be same for all the generated barcodes
        builder.setMacroPdf417FileID(Integer.parseInt(strFileID));
        // Assign segmentID in increasing order (1,2,3,....)
        builder.setMacroPdf417SegmentID(nCount);
        // Save the barcode (fileid_segmentid.png)
        builder.save(dataDir + strFileID + "_" + nCount + ".png");
    }
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder)

Example 49 with BarCodeBuilder

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

the class HidingCodeTextThatIsTooLongToDisplay method reduceTheCodeTextFontSize.

public static void reduceTheCodeTextFontSize(String dataDir) throws IOException {
    BarCodeBuilder b = new BarCodeBuilder();
    b.setEncodeType(com.aspose.barcode.EncodeTypes.DATA_MATRIX);
    b.setCodeText("The quick brown fox jumps over the lazy dog\n The quick brown fox jumps over the lazy dog\n");
    b.setCodeLocation(CodeLocation.None);
    b.setCodeTextFont(new Font("Serif", Font.BOLD + Font.ITALIC, 20));
    b.save(dataDir + "reduceFontSize.bmp", BarCodeImageFormat.Bmp);
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder) Font(java.awt.Font)

Example 50 with BarCodeBuilder

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

the class BarcodeWithSegments method main.

public static void main(String[] args) {
    // Instantiate BarCodeBuilder object
    com.aspose.barcode.BarCodeBuilder builder = new com.aspose.barcode.BarCodeBuilder();
    // Set the Code text for the barcode
    builder.setCodeText("(01)98898765432106(3202)012345(15)991231");
    // Set the symbology type to Code128
    builder.setEncodeType(com.aspose.barcode.EncodeTypes.DATABAR_EXPANDED_STACKED);
    // Set the cloumn property to define segments per row
    builder.setColumns(6);
    // Save the image
    builder.save("6segmets.png");
}
Also used : BarCodeBuilder(com.aspose.barcode.BarCodeBuilder) 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