Package org.krysalis.barcode4j.output.bitmap

Examples of org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider


      boolean antiAlias = JRProperties.getBooleanProperty(
          componentElement, PROPERTY_ANTIALIAS, true);
      int imageType = gray ? BufferedImage.TYPE_BYTE_GRAY
          : BufferedImage.TYPE_BYTE_BINARY;
     
      BitmapCanvasProvider provider = new BitmapCanvasProvider(
          out, "image/x-png", resolution, imageType, antiAlias, orientation);
      barcode.generateBarcode(provider, message);
      provider.finish();
     
      byte[] imageData = out.toByteArray();
      return JRImageRenderer.getInstance(imageData);
    }
    catch (Exception e)
View Full Code Here


                handleCache(externalContext, cache);
               
                if(format.equals("png")) {
                    externalContext.setResponseContentType("image/png");
                   
                    BitmapCanvasProvider bitmapCanvasProvider = new BitmapCanvasProvider(out, "image/x-png", 150, BufferedImage.TYPE_BYTE_BINARY, false, orientation);
                    generator.generate(bitmapCanvasProvider, value);
                    bitmapCanvasProvider.finish();
                }
                else if(format.equals("svg")) {
                    externalContext.setResponseContentType("image/svg+xml");
                   
                    SVGCanvasProvider svgCanvasProvider = new SVGCanvasProvider(false, orientation);
View Full Code Here

    String input = barcodable.getIdentificationBarcode();

    if (input != null && !"".equals(input)) {
      String enc = new String(Base64.encodeBase64(input.getBytes("UTF-8")));

      BitmapCanvasProvider provider = new BitmapCanvasProvider(bitmapResolution, imageType, antialias, orientation);
      provider.establishDimensions(dimension);
      if (barcodeGenerator instanceof AbstractBarcodeBean) {
        AbstractBarcodeBean bean = (AbstractBarcodeBean)barcodeGenerator;
        bean.setModuleWidth(UnitConv.in2mm(pointPixels / bitmapResolution));
        bean.doQuietZone(false);
        bean.generateBarcode(provider, enc);
      }
      else {
        barcodeGenerator.generateBarcode(provider, enc);
      }
      provider.finish();
      return provider.getBufferedImage();
    }
    return null;
  }
View Full Code Here

        response.setContentType("image/jpeg");
        response.setDateHeader("Expires", 0);
        DataOutputStream out = new DataOutputStream(response.getOutputStream());
        try {
            //Set up the canvas provider for monochrome JPEG output
            BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/jpeg",Convert.toInteger(dpi), BufferedImage.TYPE_BYTE_BINARY, false, Convert.toInteger(orientation));           
            //Generate the barcode
            bean.generateBarcode(canvas, codigoBarra);           
            //Signal end of generation
            canvas.finish();
        } finally {
            out.close();
        }
  }
View Full Code Here

TOP

Related Classes of org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.