dpickett / has_barcode

Nice class method wrapper for barby
MIT License
52 stars 18 forks source link

Prawn PDF bug fix & some features #10

Open AknEp opened 11 years ago

AknEp commented 11 years ago

Hi.

I found some bugs when using has_barcode with Prawn & Prawn::Rails.

I wrote model code below.

has_barcode :barcode, 
  :outputter => :pdf, 
  :type => :code_39,
  :value => Proc.new{|p| p.random_string_of_numbers}

or

has_barcode :barcode, 
  :outputter => :annotate_pdf, 
  :type => :code_39,
  :value => Proc.new{|p| p.random_string_of_numbers}

First, I fixed require bug. ( #de47b49f , #a68637b9 )

Second, I adopted it with annotate_pdf outputter. I think prawn_rails need to get Prawn::Document instance. This method seems to be good for it.

It's my first time to do "Pull Request", and I'm not good at English. Please read my RSpec & business code. :)