Search in sources :

Example 1 with Dimensions

use of com.google.zxing.pdf417.encoder.Dimensions in project weex-example by KalicyZhou.

the class PDF417Writer method encode.

@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);
}
Also used : Dimensions(com.google.zxing.pdf417.encoder.Dimensions) Charset(java.nio.charset.Charset) PDF417(com.google.zxing.pdf417.encoder.PDF417)

Example 2 with Dimensions

use of com.google.zxing.pdf417.encoder.Dimensions in project incubator-weex by apache.

the class PDF417Writer method encode.

@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);
}
Also used : Dimensions(com.google.zxing.pdf417.encoder.Dimensions) Charset(java.nio.charset.Charset) PDF417(com.google.zxing.pdf417.encoder.PDF417)

Example 3 with Dimensions

use of com.google.zxing.pdf417.encoder.Dimensions in project zxing by zxing.

the class PDF417Writer method encode.

@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);
}
Also used : Dimensions(com.google.zxing.pdf417.encoder.Dimensions) Charset(java.nio.charset.Charset) PDF417(com.google.zxing.pdf417.encoder.PDF417)

Example 4 with Dimensions

use of com.google.zxing.pdf417.encoder.Dimensions in project weiui by kuaifan.

the class PDF417Writer method encode.

@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);
}
Also used : Dimensions(vip.kuaifan.weiui.extend.integration.zxing.pdf417.encoder.Dimensions) Charset(java.nio.charset.Charset) PDF417(vip.kuaifan.weiui.extend.integration.zxing.pdf417.encoder.PDF417)

Example 5 with Dimensions

use of com.google.zxing.pdf417.encoder.Dimensions in project android-zxing by PearceXu.

the class PDF417Writer method encode.

@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);
}
Also used : Dimensions(com.google.zxing.pdf417.encoder.Dimensions) Charset(java.nio.charset.Charset) PDF417(com.google.zxing.pdf417.encoder.PDF417)

Aggregations

Charset (java.nio.charset.Charset)5 Dimensions (com.google.zxing.pdf417.encoder.Dimensions)4 PDF417 (com.google.zxing.pdf417.encoder.PDF417)4 Dimensions (vip.kuaifan.weiui.extend.integration.zxing.pdf417.encoder.Dimensions)1 PDF417 (vip.kuaifan.weiui.extend.integration.zxing.pdf417.encoder.PDF417)1