library
library copied to clipboard
Unable to scan PDF_417 codes...
Hi, trying to scan the back of a drivers license, the picture is certainly clear and large enough, but it does nothing but dump this error into the logs...
index.js:1 deocdeFromVideoDevice error: ChecksumException at ChecksumException.getChecksumInstance (http://localhost:3000/static/js/vendors~main.chunk.js:91679:12) at PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues (http://localhost:3000/static/js/vendors~main.chunk.js:116280:70) at PDF417ScanningDecoder.createDecoderResult (http://localhost:3000/static/js/vendors~main.chunk.js:116219:34) at PDF417ScanningDecoder.decode (http://localhost:3000/static/js/vendors~main.chunk.js:115963:34) at PDF417Reader.decode (http://localhost:3000/static/js/vendors~main.chunk.js:112829:100) at PDF417Reader.decode (http://localhost:3000/static/js/vendors~main.chunk.js:112776:31) at BrowserCodeReader.decodeBitmap (http://localhost:3000/static/js/vendors~main.chunk.js:86999:24) at BrowserCodeReader.decodeFromCanvas (http://localhost:3000/static/js/vendors~main.chunk.js:87008:17) at loop (http://localhost:3000/static/js/vendors~main.chunk.js:87775:28)
I've been trying for hours to scan a PDF_417 off the back of my license, I don't think it's a blurry image or anything like that, just simply think something is wrong with the checksum calculations for this bar code format.
Can anyone else scan a PDF_417 with this library?
P.S. none of the sample PDF_417 in the live demo are working either..
P.S. I did see this other type of error pop up as well, while trying to scan..
index.js:1 deocdeFromVideoDevice error: NotFoundException at NotFoundException.getNotFoundInstance (http://localhost:3000/static/js/vendors~main.chunk.js:93051:12) at PDF417ScanningDecoder.adjustCodewordCount (http://localhost:3000/static/js/vendors~main.chunk.js:116158:74) at PDF417ScanningDecoder.createDecoderResult (http://localhost:3000/static/js/vendors~main.chunk.js:116179:27) at PDF417ScanningDecoder.decode (http://localhost:3000/static/js/vendors~main.chunk.js:115963:34) at PDF417Reader.decode (http://localhost:3000/static/js/vendors~main.chunk.js:112829:100) at PDF417Reader.decode (http://localhost:3000/static/js/vendors~main.chunk.js:112776:31) at BrowserCodeReader.decodeBitmap (http://localhost:3000/static/js/vendors~main.chunk.js:86999:24) at BrowserCodeReader.decodeFromCanvas (http://localhost:3000/static/js/vendors~main.chunk.js:87008:17) at loop (http://localhost:3000/static/js/vendors~main.chunk.js:87775:28)
I have the same issue.
I would also like to use this PDF417 scan via the camera and not just an image. Is this possible?
Thank you so much for a great library!
The PDF417 bar code scanner is working, but another bar code I am trying to scan is encrypted. Is it possible to retrieve the raw data from the scan, instead of letting zxing decode the data to JSON? I have a different library that can decrypt the data.
I have the same problem. I made it work unencrypted with this code:
const fs = require('fs');
const jpeg = require('jpeg-js');
const { MultiFormatReader, BarcodeFormat, RGBLuminanceSource, BinaryBitmap, HybridBinarizer, DecodeHintType, PDF417Reader } = require('@zxing/library');
async function ServiceTest(req, res) {
var path = '{your file's path}/test01.png';
let pathData = await fs.readFileSync(path);
let decoded;
let rawImageData = await jpeg.decode(pathData) ;
const hints = new Map();
const formats = [BarcodeFormat.PDF_417];
hints.set(DecodeHintType.POSSIBLE_FORMATS, formats);
hints.set(DecodeHintType.TRY_HARDER, true);
hints.set(DecodeHintType.PURE_BARCODE, true);
hints.set(DecodeHintType.PURE_BARCODE, true);
const reader = new PDF417Reader(hints);
const len = rawImageData.width * rawImageData.height
const luminancesUint8Array = new Uint8ClampedArray(len);
for (let i = 0; i < len; i++) {
luminancesUint8Array[i] = ((rawImageData.data[i * 4] + rawImageData.data[i * 4 + 1] * 2 + rawImageData.data[i * 4 + 2]) / 4) & 0xff;
}
const luminanceSource = new RGBLuminanceSource(luminancesUint8Array, rawImageData.width, rawImageData.height);
const binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));
const detection = reader.decode(binaryBitmap);
console.log(detection.getText());
console.log(detection.getBarcodeFormat());
console.log(detection.putAllMetadata());
}
However, when I try to read an encrypted PDF417, I get some errors.
If i use "PDF417Reader":
If i use "MultiFormatReader":
Did you find a solution?
@rlyle - Were you ever able to get the back of drivers license scan working?
I have the same use case and am getting the same error. I've tried all the way up to 600dpi quality scan in both black and white and color using the ZXing.BrowserPDF417Reader or the ZXing.MultiFormatReader
I was having the same issue and this suggested workaround got me going.
@rlyle - Were you ever able to get the back of drivers license scan working?
I have the same use case and am getting the same error. I've tried all the way up to 600dpi quality scan in both black and white and color using the ZXing.BrowserPDF417Reader or the ZXing.MultiFormatReader
Nope, we just gave up on supporting PC scanning.. which was ok for us, as our primary users are on iOS and android.
For me the reason it was not working was that I was passing a UInt8ClampedArray. Apparently, it only works with Int32Array so the workaround was doing new Int32Array(clampedArray.buffer)
Stale issue message