hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
throws the error: java.lang.ClassCastException: com.google.zxing.qrcode.decoder.ErrorCorrectionLevel cannot be cast to java.lang.Number
You can set it to an integer and it works fine.
hintMap.put(EncodeHintType.ERROR_CORRECTION, 2); // this works
The problem code is in the PDF417Writer class.
I believe this:
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = ((Number) hints.get(EncodeHintType.ERROR_CORRECTION)).intValue();
}
should be this:
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = ((int) hints.get(EncodeHintType.ERROR_CORRECTION)).intValue();
}