code39 not looking like code39 to me or the scanner.

29 views
Skip to first unread message

coalex

unread,
Dec 16, 2009, 7:03:46 PM12/16/09
to Barby
Hi Group,
I got this gem working pretty easily on my development box for
testing...

I'm running
WindowsXP
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
gem 0.9.2
rmagick, version 2.12.0
barby-0.3.1.gem

and doing:

irb -rubygems

require 'barby'
require 'barby/outputter/rmagick_outputter'
barcode = Barby::Code39.new('D4604', true)
File.open('code39.jpg','w'){|f| f.write barcode.to_jpg}

...prints the code39.jpg just fine, but the image doesn't look correct
(not like a typical 3 of 9) and will not scan when printed.

I'm suspecting my rmagick version. But I really have no clue what
could be going wrong.
Any ideas. Thanks All.

Tore Darell

unread,
Dec 17, 2009, 2:21:42 AM12/17/09
to Barby
Hi,

Can you upload the image somewhere?

Tore

coalex

unread,
Dec 17, 2009, 11:46:40 AM12/17/09
to Barby
Hi Tore,
Thanks for the reply. I have upload an image here:
http://groups.google.com/group/ruby-barby/web/funny_code39_n_Barby.jpg

This (barcode feature) was a request from a user, I'm not very
familiar with the Barcode world, code and otherwise. In fact this is
day 2.

But I like this gem and found it a pleasure to work with. If only I
can get it to output correctly.
Thanks for any insight.
A

coalex

unread,
Dec 17, 2009, 12:04:26 PM12/17/09
to Barby
BTW...
The Barby output appears to be correct in acsii.
and
When I opened the Code39.jpg in Photoshop it complained:

This document may be damaged (The file maybe truncated or incomplete).

might be a clue on the issue(s).
Thanks again,
A

Tore Darell

unread,
Dec 17, 2009, 12:31:19 PM12/17/09
to Barby
Just noticed you're on windows and there's no "b" flag in your
File.open, what happens if you add it? Windows requires you to open
files in "binary" mode, otherwise it does silly things. That is,
change this:

File.open('code39.jpg','w'){|f| f.write barcode.to_jpg}

to this:

File.open('code39.jpg','wb'){|f| f.write barcode.to_jpg}

coalex

unread,
Dec 17, 2009, 12:55:36 PM12/17/09
to Barby
Works now! Thanks Tore.

I'll be deploying to Redhat AS5.
Should I exclude the "b" in (File.open('code39.jpg','wb')) while
testing there, or will Redhat deal?

Tore Darell

unread,
Dec 17, 2009, 1:00:53 PM12/17/09
to ruby-...@googlegroups.com
Cool :) RedHat won't have this problem, so you don't need the "b" flag
there. I don't think leaving it in is a problem though, if you want to
make sure it works on Windows too..

> --
>
> You received this message because you are subscribed to the Google Groups "Barby" group.
> To post to this group, send email to ruby-...@googlegroups.com.
> To unsubscribe from this group, send email to ruby-barby+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ruby-barby?hl=en.
>
>
--
Tore Darell
tored...@gmail.com
http://tore.darell.no/
FR-06200 Nice

Reply all
Reply to author
Forward
0 new messages