Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF417 decoding is incomplete #3

Open
Naahuel opened this issue Feb 2, 2019 · 14 comments
Open

PDF417 decoding is incomplete #3

Naahuel opened this issue Feb 2, 2019 · 14 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Naahuel
Copy link

Naahuel commented Feb 2, 2019

Hello!

I am attempting to make a PDF417 barcode reader for the web using Web Assembly (there's a few out there but the only reliable one is licenced). The idea is simple, just build a binary file with C code that can be called via JavaScript.

I followed this guide which got me almost there! I had to add --enable-codes=pdf417 as a parameter to configure to enable PDF417 symbols and disable all the others I'm not interested in.

The code actually works amazingly well for any other type of symbol (see demo) but if I compile ZBar to accept PDF417, it detects it but throws a warning:

WARNING: zbar/decoder/pdf417.c:73: pdf417_decode8: Assertion "clst >= 0 && clst < 9" failed.
dir=0 sig=5a44 k=9 buf[0000]=

WARNING: zbar/decoder/pdf417.c:89: pdf417_decode8: Assertion "g[0] >= 0 && g[1] >= 0 && g[2] >= 0" failed.
dir=1 sig=ca03 k=6 g0=ffffffff g1=e71 g2=585 buf[0000]=

And of course, no decoding is done. Those assertions are on lines 71 and 86 of ZBar.

You can see all the code I'm using in the guide I mentioned earlier (the only difference is that I enabled PDF417 before compiling)

For any other type of barcode it works amazingly! Is PDF417 not fully implemented? Is there anything I can do to make it work?

@jasp00
Copy link

jasp00 commented Feb 2, 2019

It looks like PDF417 support is incomplete. So someone should have access to the standard and finish the implementation.

@Naahuel
Copy link
Author

Naahuel commented Feb 3, 2019

Thanks for answering. That's what I thought, yes. Unfortunately I'm not skilled enough to do that and it looks awfully complex. So I guess I'll just keep looking for some other c library that has that

@mchehab
Copy link
Owner

mchehab commented Feb 4, 2019

I double-checked at the code with some debug bits enabled. It seems that the pdf417 code already parses the image correctly. However, it misses the part of the code with would be producing the actual image decoding, as commented on its source:
/* FIXME TBD infer dimensions, save codewords */
I don't have the specs myself. This is an ISO standard (ISO/IEC 15438, probably implemented based at its second version from 2006). No idea how complex would be to finish the implementation, or if it would be possible to finish it by looking at some other open source file from other projects.
I opted to add a warning at the configure.ac, in order to warn about that when building it.

@Naahuel
Copy link
Author

Naahuel commented Feb 4, 2019

Thank you @mchehab Hopefully it'll be implemented soon!

I ended up using a cpp port of ZXing which can compile to wasm and be used with WebAssembly. It works Ok, but not better than the pure JavaScript implementation. The output wasm file is also quite large.

@mchehab mchehab changed the title PDF417 decoding doesn't work? PDF417 decoding is incomplete Feb 5, 2019
@mchehab
Copy link
Owner

mchehab commented Feb 5, 2019

I ended up using a cpp port of ZXing

Unfortunately, ZXing is Apache licensed. For us, the better would be either if someone with time could finish the implementation from scratch or if we could use some code from another LGPL 2.1 compatible project.

I did a quick search for other ZBar patches that might be floating around, but didn't see anything finishing the PDF417 implementation.

I probably won't have any time myself to do such coding.

So, volunteers for this task are wanted!

@cb49747
Copy link

cb49747 commented Oct 15, 2020

Is there any update on getting pdf417 support for zbar? I would help but way above my skill set. I'm looking a writing a perl solution to reading these barcodes.

@dearsina
Copy link

Any update to PDF417 support? It's becoming an important barcode format. Thanks.

@haimat
Copy link

haimat commented Dec 5, 2021

Same here - any update on this PDF417 support in zbar?

@jameshilliard
Copy link
Contributor

jameshilliard commented Nov 6, 2022

Unfortunately, ZXing is Apache licensed. For us, the better would be either if someone with time could finish the implementation from scratch or if we could use some code from another LGPL 2.1 compatible project.

The zint implementation is in c an should be LGPL2.1 comaptible AFAIU(BSD-3-Clause), although I think it's encode only.

@vishaljangid1729
Copy link

I am attempting to use the ZBar library to decode PDF417 barcodes on the web using Web Assembly. I need help with detecting PDF417.

I have tested the ZBar library with other types of barcodes, and it works perfectly, so the issue is specific to PDF417 decoding.

Could someone from the community or the ZBar development team help me troubleshoot this issue? Is there a workaround or a fix that I can apply to resolve this problem?

@jameshilliard
Copy link
Contributor

Is there a workaround or a fix that I can apply to resolve this problem?

From my understanding pdf417 support is effectively completely broken in zbar and would need significant development work to make functional.

@vishaljangid1729
Copy link

Is there a workaround or a fix that I can apply to resolve this problem?

From my understanding pdf417 support is effectively completely broken in zbar and would need significant development work to make functional.

I am facing this issue in production. I need urgent help on this. Can anyone help me on this please.

@haimat
Copy link

haimat commented Apr 18, 2023

I am facing this issue in production. I need urgent help on this. Can anyone help me on this please.

I had the same issue, but was not able to solve it via zbar. Thus I ended up with pdf417decoder.
If you are using Python you could give that library a try. Good luck!

@jameshilliard
Copy link
Contributor

I am facing this issue in production. I need urgent help on this. Can anyone help me on this please.

You probably need to look into using something like ZXing for pdf417 decoding at the moment.

I am attempting to use the ZBar library to decode PDF417 barcodes on the web using Web Assembly.

The ZXing library supports webassembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants