Java Code Examples for com.google.zxing.BarcodeFormat#PDF_417

The following examples show how to use com.google.zxing.BarcodeFormat#PDF_417 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDF417Reader.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public Result decode(BinaryBitmap binarybitmap, Map map)
{
    DecoderResult decoderresult;
    ResultPoint aresultpoint[];
    if (map != null && map.containsKey(DecodeHintType.PURE_BARCODE))
    {
        BitMatrix bitmatrix = a(binarybitmap.getBlackMatrix());
        decoderresult = b.decode(bitmatrix);
        aresultpoint = a;
    } else
    {
        DetectorResult detectorresult = (new Detector(binarybitmap)).detect();
        decoderresult = b.decode(detectorresult.getBits());
        aresultpoint = detectorresult.getPoints();
    }
    return new Result(decoderresult.getText(), decoderresult.getRawBytes(), aresultpoint, BarcodeFormat.PDF_417);
}
 
Example 2
Source File: PDF417Writer.java    From letv with Apache License 2.0 6 votes vote down vote up
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints) throws WriterException {
    if (format != BarcodeFormat.PDF_417) {
        throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
    }
    PDF417 encoder = new PDF417();
    if (hints != null) {
        if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
            encoder.setCompact(((Boolean) hints.get(EncodeHintType.PDF417_COMPACT)).booleanValue());
        }
        if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
            encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
        }
        if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
            Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
            encoder.setDimensions(dimensions.getMaxCols(), dimensions.getMinCols(), dimensions.getMaxRows(), dimensions.getMinRows());
        }
    }
    return bitMatrixFromEncoder(encoder, contents, width, height);
}
 
Example 3
Source File: PDF417Reader.java    From reacteu-app with MIT License 6 votes vote down vote up
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
    throws NotFoundException, FormatException, ChecksumException {
  DecoderResult decoderResult;
  ResultPoint[] points;
  if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
    BitMatrix bits = extractPureBits(image.getBlackMatrix());
    decoderResult = decoder.decode(bits);
    points = NO_POINTS;
  } else {
    DetectorResult detectorResult = new Detector(image).detect();
    decoderResult = decoder.decode(detectorResult.getBits());
    points = detectorResult.getPoints();
  }
  return new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
      BarcodeFormat.PDF_417);
}
 
Example 4
Source File: PDF417Reader.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple) 
    throws NotFoundException, FormatException, ChecksumException {
  List<Result> results = new ArrayList<>();
  PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
  for (ResultPoint[] points : detectorResult.getPoints()) {
    DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
        points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
    PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
    if (pdf417ResultMetadata != null) {
      result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
    }
    results.add(result);
  }
  return results.toArray(new Result[results.size()]);
}
 
Example 5
Source File: PDF417Reader.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple) 
    throws NotFoundException, FormatException, ChecksumException {
  List<Result> results = new ArrayList<>();
  PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
  for (ResultPoint[] points : detectorResult.getPoints()) {
    DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
        points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
    PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
    if (pdf417ResultMetadata != null) {
      result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
    }
    results.add(result);
  }
  return results.toArray(new Result[results.size()]);
}
 
Example 6
Source File: PDF417Reader.java    From weex with Apache License 2.0 6 votes vote down vote up
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple) 
    throws NotFoundException, FormatException, ChecksumException {
  List<Result> results = new ArrayList<>();
  PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
  for (ResultPoint[] points : detectorResult.getPoints()) {
    DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
        points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
    PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
    if (pdf417ResultMetadata != null) {
      result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
    }
    results.add(result);
  }
  return results.toArray(new Result[results.size()]);
}
 
Example 7
Source File: PDF417Reader.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple) 
    throws NotFoundException, FormatException, ChecksumException {
  List<Result> results = new ArrayList<>();
  PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
  for (ResultPoint[] points : detectorResult.getPoints()) {
    DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
        points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
    PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
    if (pdf417ResultMetadata != null) {
      result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
    }
    results.add(result);
  }
  return results.toArray(new Result[results.size()]);
}
 
Example 8
Source File: ZXingDecoder.java    From react-native-barcode with MIT License 5 votes vote down vote up
private static BarcodeFormat formatToSymbol(int format) {
    if (225 == format) {
        return BarcodeFormat.AZTEC;
    } else if (38 == format) {
        return BarcodeFormat.CODABAR;
    } else if (128 == format) {
        return BarcodeFormat.CODE_128;
    } else if (39 == format) {
        return BarcodeFormat.CODE_39;
    } else if (93 == format) {
        return BarcodeFormat.CODE_93;
    } else if (200 == format) {
        return BarcodeFormat.DATA_MATRIX;
    } else if (13 == format) {
        return BarcodeFormat.EAN_13;
    } else if (8 == format) {
        return BarcodeFormat.EAN_8;
    } else if (25 == format) {
        return BarcodeFormat.ITF;
    } else if (94 == format) {
        return BarcodeFormat.MAXICODE;
    } else if (57 == format) {
        return BarcodeFormat.PDF_417;
    } else if (64 == format) {
        return BarcodeFormat.QR_CODE;
    } else if (34 == format) {
        return BarcodeFormat.RSS_14;
    } else if (35 == format) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if (12 == format) {
        return BarcodeFormat.UPC_A;
    } else if (9 == format) {
        return BarcodeFormat.UPC_E;
    } else if (15 == format) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    }
    return null;
}
 
Example 9
Source File: PDF417Writer.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private static c a(BarcodeFormat barcodeformat, boolean flag)
{
    if (barcodeformat != BarcodeFormat.PDF_417)
    {
        throw new IllegalArgumentException((new StringBuilder()).append("Can only encode PDF_417, but got ").append(barcodeformat).toString());
    } else
    {
        c c1 = new c();
        c1.a(flag);
        return c1;
    }
}
 
Example 10
Source File: PDF417Writer.java    From reacteu-app with MIT License 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.PDF_417) {
    throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
  }

  PDF417 encoder = new PDF417();

  if (hints != null) {
    if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
      encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
    }
    if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
      encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
    }
    if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
      Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
      encoder.setDimensions(dimensions.getMaxCols(),
                            dimensions.getMinCols(),
                            dimensions.getMaxRows(),
                            dimensions.getMinRows());
    }
  }

  return bitMatrixFromEncoder(encoder, contents, width, height);
}
 
Example 11
Source File: PDF417Writer.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.PDF_417) {
    throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
  }

  PDF417 encoder = new PDF417();
  int margin = WHITE_SPACE;

  if (hints != null) {
    if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
      encoder.setCompact((Boolean) hints.get(EncodeHintType.PDF417_COMPACT));
    }
    if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
      encoder.setCompaction((Compaction) hints.get(EncodeHintType.PDF417_COMPACTION));
    }
    if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
      Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
      encoder.setDimensions(dimensions.getMaxCols(),
                            dimensions.getMinCols(),
                            dimensions.getMaxRows(),
                            dimensions.getMinRows());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      margin = ((Number) hints.get(EncodeHintType.MARGIN)).intValue();
    }
    if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
      String encoding = (String) hints.get(EncodeHintType.CHARACTER_SET);
      encoder.setEncoding(Charset.forName(encoding));
    }
  }

  return bitMatrixFromEncoder(encoder, contents, width, height, margin);
}
 
Example 12
Source File: GeneralHandler.java    From SecScanQR with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Method is used to convert parsed String to BarcodeFormat to create an image of the qr code
 * @param stringFormat as String
 * @return format as BarcodeFormat
 */
public BarcodeFormat StringToBarcodeFormat(String stringFormat){
    BarcodeFormat format;
    switch(stringFormat){
        case "CODBAR":
            format = BarcodeFormat.CODABAR;
            break;
        case "CODE_128":
            format= BarcodeFormat.CODE_128;
            break;
        case "CODE_39":
            format = BarcodeFormat.CODE_39;
            break;
        case "EAN_13":
            format = BarcodeFormat.EAN_13;
            break;
        case "EAN_8":
            format = BarcodeFormat.EAN_8;
            break;
        case "ITF":
            format = BarcodeFormat.ITF;
            break;
        case "PDF_417":
            format = BarcodeFormat.PDF_417;
            break;
        case "UPC_A":
            format = BarcodeFormat.UPC_A;
            break;
        case "QR_CODE":
            format = BarcodeFormat.QR_CODE;
            break;
        case "AZTEC":
            format = BarcodeFormat.AZTEC;
            break;
        default:
            format = BarcodeFormat.CODABAR;
            break;
    }
    return format;
}
 
Example 13
Source File: GeneralHandler.java    From SecScanQR with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Method is used to convert parsed id to BarcodeFormat to create an image of the qr code
 * @param id as int
 * @return format as BarcodeFormat
 */
public BarcodeFormat idToBarcodeFormat(int id){
    BarcodeFormat format;
    switch(id){
        case 1:
            format = BarcodeFormat.CODABAR;
            break;
        case 2:
            format= BarcodeFormat.CODE_128;
            break;
        case 3:
            format = BarcodeFormat.CODE_39;
            break;
        case 4:
            format = BarcodeFormat.EAN_13;
            break;
        case 5:
            format = BarcodeFormat.EAN_8;
            break;
        case 6:
            format = BarcodeFormat.ITF;
            break;
        case 7:
            format = BarcodeFormat.PDF_417;
            break;
        case 8:
            format = BarcodeFormat.UPC_A;
            break;
        case 9:
            format = BarcodeFormat.QR_CODE;
            break;
        case 10:
            format = BarcodeFormat.AZTEC;
            break;
        default:
            format = BarcodeFormat.CODABAR;
            break;
    }
    return format;
}
 
Example 14
Source File: ZXingDecoder.java    From react-native-barcode with MIT License 5 votes vote down vote up
private static int symbolToFormat(BarcodeFormat symbol) {
    if (BarcodeFormat.AZTEC == symbol) {
        return 225;
    } else if (BarcodeFormat.CODABAR == symbol) {
        return 38;
    } else if (BarcodeFormat.CODE_128 == symbol) {
        return 128;
    } else if (BarcodeFormat.CODE_39 == symbol) {
        return 39;
    } else if (BarcodeFormat.CODE_93 == symbol) {
        return 93;
    } else if (BarcodeFormat.DATA_MATRIX == symbol) {
        return 200;
    } else if (BarcodeFormat.EAN_13 == symbol) {
        return 13;
    } else if (BarcodeFormat.EAN_8 == symbol) {
        return 8;
    } else if (BarcodeFormat.ITF == symbol) {
        return 25;
    } else if (BarcodeFormat.MAXICODE == symbol) {
        return 94;
    } else if (BarcodeFormat.PDF_417 == symbol) {
        return 57;
    } else if (BarcodeFormat.QR_CODE == symbol) {
        return 64;
    } else if (BarcodeFormat.RSS_14 == symbol) {
        return 34;
    } else if (BarcodeFormat.RSS_EXPANDED == symbol) {
        return 35;
    } else if (BarcodeFormat.UPC_A == symbol) {
        return 12;
    } else if (BarcodeFormat.UPC_E == symbol) {
        return 9;
    } else if (BarcodeFormat.UPC_EAN_EXTENSION == symbol) {
        return 15;
    }
    return -1;
}
 
Example 15
Source File: PDF417Writer.java    From weex with Apache License 2.0 4 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.PDF_417) {
    throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
  }

  PDF417 encoder = new PDF417();
  int margin = WHITE_SPACE;
  int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;

  if (hints != null) {
    if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
      encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPACT).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
      encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417_COMPACTION).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
      Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
      encoder.setDimensions(dimensions.getMaxCols(),
                            dimensions.getMinCols(),
                            dimensions.getMaxRows(),
                            dimensions.getMinRows());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
      Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
      encoder.setEncoding(encoding);
    }
  }

  return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
 
Example 16
Source File: PDF417Writer.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.PDF_417) {
    throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
  }

  PDF417 encoder = new PDF417();
  int margin = WHITE_SPACE;
  int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;

  if (hints != null) {
    if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
      encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPACT).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
      encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417_COMPACTION).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
      Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
      encoder.setDimensions(dimensions.getMaxCols(),
                            dimensions.getMinCols(),
                            dimensions.getMaxRows(),
                            dimensions.getMinRows());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
      Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
      encoder.setEncoding(encoding);
    }
  }

  return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
 
Example 17
Source File: PDF417Writer.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.PDF_417) {
    throw new IllegalArgumentException("Can only encode PDF_417, but got " + format);
  }

  PDF417 encoder = new PDF417();
  int margin = WHITE_SPACE;
  int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;

  if (hints != null) {
    if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
      encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPACT).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
      encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417_COMPACTION).toString()));
    }
    if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
      Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIMENSIONS);
      encoder.setDimensions(dimensions.getMaxCols(),
                            dimensions.getMinCols(),
                            dimensions.getMaxRows(),
                            dimensions.getMinRows());
    }
    if (hints.containsKey(EncodeHintType.MARGIN)) {
      margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
    }
    if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
      errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION).toString());
    }
    if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
      Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
      encoder.setEncoding(encoding);
    }
  }

  return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin);
}
 
Example 18
Source File: RCTCameraViewFinder.java    From react-native-camera-face-detector with MIT License 4 votes vote down vote up
/**
 * Parse barcodes as BarcodeFormat constants.
 *
 * Supports all iOS codes except [code39mod43, itf14]
 *
 * Additionally supports [codabar, maxicode, rss14, rssexpanded, upca, upceanextension]
 */
private BarcodeFormat parseBarCodeString(String c) {
    if ("aztec".equals(c)) {
        return BarcodeFormat.AZTEC;
    } else if ("ean13".equals(c)) {
        return BarcodeFormat.EAN_13;
    } else if ("ean8".equals(c)) {
        return BarcodeFormat.EAN_8;
    } else if ("qr".equals(c)) {
        return BarcodeFormat.QR_CODE;
    } else if ("pdf417".equals(c)) {
        return BarcodeFormat.PDF_417;
    } else if ("upce".equals(c)) {
        return BarcodeFormat.UPC_E;
    } else if ("datamatrix".equals(c)) {
        return BarcodeFormat.DATA_MATRIX;
    } else if ("code39".equals(c)) {
        return BarcodeFormat.CODE_39;
    } else if ("code93".equals(c)) {
        return BarcodeFormat.CODE_93;
    } else if ("interleaved2of5".equals(c)) {
        return BarcodeFormat.ITF;
    } else if ("codabar".equals(c)) {
        return BarcodeFormat.CODABAR;
    } else if ("code128".equals(c)) {
        return BarcodeFormat.CODE_128;
    } else if ("maxicode".equals(c)) {
        return BarcodeFormat.MAXICODE;
    } else if ("rss14".equals(c)) {
        return BarcodeFormat.RSS_14;
    } else if ("rssexpanded".equals(c)) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if ("upca".equals(c)) {
        return BarcodeFormat.UPC_A;
    } else if ("upceanextension".equals(c)) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    } else {
        android.util.Log.v("RCTCamera", "Unsupported code.. [" + c + "]");
        return null;
    }
}
 
Example 19
Source File: BarcodeGeneratorServiceImpl.java    From axelor-open-suite with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public InputStream createBarCode(
    String serialno, BarcodeTypeConfig barcodeTypeConfig, boolean isPadding)
    throws AxelorException {

  if (serialno != null && barcodeTypeConfig != null) {
    BarcodeFormat barcodeFormat = null;
    switch (barcodeTypeConfig.getName()) {
      case "AZTEC":
        barcodeFormat = BarcodeFormat.AZTEC;
        break;

      case "CODABAR":
        barcodeFormat = BarcodeFormat.CODABAR;
        serialno = checkTypeForCodabar(serialno, barcodeFormat);
        break;

      case "CODE_39":
        barcodeFormat = BarcodeFormat.CODE_39;
        serialno = checkTypeForCode39(serialno, barcodeFormat);
        break;

      case "CODE_128":
        barcodeFormat = BarcodeFormat.CODE_128;
        break;

      case "DATA_MATRIX":
        barcodeFormat = BarcodeFormat.DATA_MATRIX;
        break;

      case "EAN_8":
        barcodeFormat = BarcodeFormat.EAN_8;
        serialno = checkTypeForEan8(serialno, barcodeFormat, isPadding);
        break;

      case "ITF":
        barcodeFormat = BarcodeFormat.ITF;
        serialno = checkTypeForItf(serialno, barcodeFormat, isPadding);
        break;

      case "PDF_417":
        barcodeFormat = BarcodeFormat.PDF_417;
        serialno = checkTypeForPdf417(serialno, barcodeFormat, isPadding);
        break;

      case "QR_CODE":
        barcodeFormat = BarcodeFormat.QR_CODE;
        break;

      case "UPC_A":
        barcodeFormat = BarcodeFormat.UPC_A;
        serialno = checkTypeForUpca(serialno, barcodeFormat, isPadding);
        break;

      case "EAN_13":
        barcodeFormat = BarcodeFormat.EAN_13;
        serialno = checkTypeForEan13(serialno, barcodeFormat, isPadding);
        break;

      default:
        throw new AxelorException(
            TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
            I18n.get(IExceptionMessage.BARCODE_GENERATOR_9));
    }
    return generateBarcode(serialno, barcodeTypeConfig, barcodeFormat);
  }
  return null;
}