saritha chakilala
2012-Aug-07 13:23 UTC
Barcode Generating With Label On Canvas by using Barby gem
********UNDEFINED METHOD REGISTER ERROR IN THE FALLOWING CODE *******
Hi all,
I am trying to generate barcode(including its name as label at the
bottom of barcode image for easy understand with out scanning by barcode
scanner).
For this I am Using barby, chuncky_png, rmagick gems.
I am using the fallowing code to generate label at bottom of image by
using rmagick gem:
gem ''barby''
gem ''chunky_png''
gem ''rmagick''
require ''rubygems''
require ''barby''
require ''barby/outputter/rmagick_outputter''
require ''barby/barcode/code_128''
require ''barby/outputter/prawn_outputter''
require ''pdf/writer''
module Barby
class RmBarcode < ActiveRecord::Base
register :to_image_with_data
def to_image_with_data
#Make canvas bigger
canvas = Magick::ImageList.new
canvas.new_image(full_width , full_height + 10)
canvas << to_image
canvas = canvas.flatten_images
#Make the text
text = Magick::Draw.new
text.font_family = ''helvetica''
text.pointsize = 14
text.gravity = Magick::SouthGravity
text.annotate(canvas , 0,0,0,0, barcode.data)
canvas
end
end
end
barcode = Barby::Code128B.new(''Barcode Code Here'')
barcode.to_image_with_data.write(''barcode_2.png'')
but I am getting the fallowing error:
undefined method `register'' for #<Class:0x4d08ef0>
yy??
any information that is valuable to me.
thanks in advance..........
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
White head
2013-Dec-12 02:26 UTC
Re: Barcode Generating With Label On Canvas by using Barby gem
Barcode generating on image and document page, image barcode add-on is a toolkit that can be applied to create linear and 2d barcodes on image or document page, like linear code 39, code 128, ean-8, ean-13, ISBN, ISSN, etc. and 2d qr code, pdf 417 as well as data matrix. http://www.rasteredge.com/how-to/asp-net-imaging/barcode-generating/ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/daa57897f6a1e807fe2f6d4879bd7926%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
beverly daddzie
2013-Dec-12 08:28 UTC
Re: Barcode Generating With Label On Canvas by using Barby gem
Barcode font tool package is capable of printing 2D and linear barcode fonts to 32 and 64-bit operating systems. OS supported by the font tool include Microsoft Windows, Mac OS X, Pocket PC, Linux, and Unix. See Integrated Operating Systems. http://www.keepautomation.com/guide/barcode_fonts.html -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1ef9457df293652face8d4a2803d664b%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
sharath
2013-Dec-13 09:10 UTC
Re: Barcode Generating With Label On Canvas by using Barby gem
Thank you beverly daddzie. Will evaluate your suggestion. On Thursday, 12 December 2013 13:58:17 UTC+5:30, Ruby-Forum.com User wrote:> > Barcode font tool package is capable of printing 2D and linear barcode > fonts to 32 and 64-bit operating systems. OS supported by the font tool > include Microsoft Windows, Mac OS X, Pocket PC, Linux, and Unix. See > Integrated Operating Systems. > > http://www.keepautomation.com/guide/barcode_fonts.html > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/498f28cf-8a85-4b01-8b85-d26e2cbb0778%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.