asee / pdf417

A Ruby wrapper for the PDF417 barcode library
MIT License
15 stars 20 forks source link

Symbol not found: _STR2CSTR #1

Open meesterdude opened 13 years ago

meesterdude commented 13 years ago

running ruby 1.9.2 ala RVM, get this error. From the looks of it, it was removed in ruby 1.9 in favor of StringValuePtr i believe... frankly a level of programming still outside of my skillset (otherwise i'd happily fix myself!)

jamesprior commented 13 years ago

Thanks for the update, I think I saw that the string handling was different but I (clearly) haven't tested in 1.9.2. FYI I think that there are still some outstanding issues for some of the more complicated barcodes too, getting the rows and cols back correctly.

meesterdude commented 13 years ago

I'm making an app that needs pdf417 barcodes, this (seems) cleaner overall but my next bet is barby but pdf417 in there requires it to be on jruby since it uses the java version. or something along those lines. oy...

well after much stumbling and poking i merely replaced it, rebuilt, and while installing got this:

pdf417.c: In function ‘refreshStruct’: pdf417.c:260: error: lvalue required as unary ‘&’ operand pdf417.c:275: warning: assignment discards qualifiers from pointer target type pdf417.c:277: warning: implicit conversion shortens 64-bit value into a 32-bit value pdf417.c:278: error: lvalue required as unary ‘&’ operand make: *\ [pdf417.o] Error 1

which is where I go googlyeyed.

anyway, figured i'd offer my findings for what use they may have. Sorry I can't be of more assistance.

jamesprior commented 13 years ago

Yeah, thanks for the debug log - FWIW there are postscript packages to do 2D barcodes, which with some futzing can get into an rtex template. I admit it comes with its own environment setup headaches, but that's what we've been using for PDF417 barcodes in PDF documents. Look for the pst-barcode latex package, the auto-pst-pdf package for getting it put together in one call, or pstricks for the postscript version. Note that if you do use rtex you'll need to patch it to pass in the --shell-escape processing parameter.

meesterdude commented 13 years ago

Yeah I was looking into that was well, but I'm unsure it'll work out. Well, I was hoping to deploy this as a rails app on heroku but more and more it looks like i'll have to externalize the barcode aspect in some manner and query a url to return a image. Whatever.

Thank you for being so responsive and for the advice. if/when you make the gem 1.9 friendly, you've got yourself a tester.

jamesprior commented 13 years ago

Okay, go ahead and give it another shot. I haven't installed RVM but I have changed how and when it goes back to the lib and gotten rid of the STR2CSTR call. Also, version 0.2.0 has a to_png method which chunky_png to make outputting a little easier.

meesterdude commented 13 years ago

Yes, version 0.2.0 works in ruby 1.9.2.and works like a charm, at that!

also confirmed the to_png works ala the chunky_png gem and definitely a welcome addition, i couldn't get the to_blob to work for the life of me.

after setting the rows and cols properties before calling to_png, I was also able to properly decode it via an online decoder.

very awesome! very exciting to see this working.

i'm still learning about pdf417, but Is quiet zone and compact mode on the roadmap? from playing with online generators they all seem to have that, and they are both things I need, but i'm not sure how important they are overall to people who need pdf417 generation when compared to something like error correction or foreground/background colors. (if ANY of those things would matter to others, at that.)

thanks again for the update!

jamesprior commented 13 years ago

Hooray! For quiet zone, if I'm reading that right it's just an extra margin around the barcode. Right now that's not set to much in the to_png output, but you can adjust it by passing in a hash w/ a value for margin, eg:

to_png(:margin => 100)

There is a defined minimum for the spec based off of the size of the other elements, I'm not sure if I'll try to calculate and enforce that or not. It feels like a bit of a waste since people can/will likely override that if they really want to snuggle it up to some other graphic.

For compact mode, I'm not sure. It looks like it is a matter of dropping the stop sequence and one codeword. The stop sequence would be easy enough to strip out, we know what that's supposed to look like but I haven't looked at what it would take to find the last codeword and drop it. So I suppose that's a long way of saying that there isn't much of a roadmap but that I don't think it is something that would be prohibitively complex.

FWIW there is an error_level setting that it will respect, if it's unset it will try to set it to the highest allowed for the rows and cols.

meesterdude commented 13 years ago

ok, good to know about the quiet zone / margin. Not what i thought it was, but yes just extra margin around the barcode. not a big deal at all in hindsight.

yes compact mode is also aka truncated it seems, from barcodephp.com manual: "Cuts the barcode by removing the 2 last columns on the right. Your barcode will be smaller but harder to read." although i can't find anything more spec-like that backs that up. Guess I'll tinker in photoshop and see what happens via the decoder to better understand.