use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.
the class BarcodeImageMargins method main.
public static void main(String[] args) {
// The path to the resource directory.
String dataDir = Utils.getDataDir(BarcodeImageMargins.class) + "BarcodeImage/BasicFeatures/";
BarCodeBuilder bb = new BarCodeBuilder();
bb.setCodeText("1234567");
bb.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_128);
bb.getMargins().setLeft(2f);
bb.getMargins().setRight(2f);
bb.getMargins().setTop(2f);
bb.getMargins().setBottom(2f);
// Save the image
bb.save(dataDir + "barcode-image-margins.jpg");
}
use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.
the class RotateBarcodeImage method main.
public static void main(String[] args) {
// The path to the resource directory.
String dataDir = Utils.getDataDir(RotateBarcodeImage.class) + "BarcodeImage/BasicFeatures/";
BarCodeBuilder bb = new BarCodeBuilder();
bb.setCodeText("1234567");
bb.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_39_EXTENDED);
// Rotate clockwise for 180 degree (upside down)
bb.setRotationAngleF(180);
// Save the image
bb.save(dataDir + "barcode-image-rotate.jpg");
}
use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.
the class RenderBarcodeToImageInstance method main.
public static void main(String[] args) {
BarCodeBuilder bb = new BarCodeBuilder();
bb.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_128);
bb.setCodeText("12345678");
// Generate bar code image
Image image = bb.generateBarCodeImage();
}
use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.
the class RenderBarcodeToServlet method doGet.
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
BarCodeBuilder b = new BarCodeBuilder();
b.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_128);
b.setCodeText("12345678");
BufferedImage image = b.getBarCodeImage();
response.setContentType("image/png");
OutputStream outputStream = response.getOutputStream();
ImageIO.write(image, "png", outputStream);
outputStream.close();
}
use of com.aspose.barcode.BarCodeBuilder in project Aspose.BarCode-for-Java by aspose-barcode.
the class BarcodeImageResolution method main.
public static void main(String[] args) {
// The path to the resource directory.
String dataDir = Utils.getDataDir(BarcodeImageResolution.class) + "BarcodeImage/UtilityFeatures/";
// Instantiate barcode object
BarCodeBuilder bb = new BarCodeBuilder();
// Set the Code text for the barcode
bb.setCodeText("1234567");
// Set the symbology type to code128
bb.setEncodeType(com.aspose.barcode.EncodeTypes.CODE_128);
// Create an instance of resolution and apply on the barcode image with
// customized resolution settings
bb.setResolution(new Resolution(200f, 400f, ResolutionMode.Customized));
// Save the image
bb.save(dataDir + "barcode-image-resolution.jpg");
}
Aggregations