Kevin Marsh
12/18/2008 11:40:00 PM
[Note: parts of this message were removed to make it a legal post.]
Hate to resurrect an old thread, but I got this to work with Prawn, and it's
pretty slick.
(This is in a prawnto/Rails view)
require 'barby'
require 'barby/outputter/prawn_outputter'
pdf.bounding_box [450,700], :width => 100 do
barcode = Barby::Code39.new(@order.order_identifier)
barcode.annotate_pdf(pdf, :height => 30)
end
Plops a nice vector barcode right there. Really slick!
Kevin
On Sat, Jul 12, 2008 at 11:20 AM, Tore Darell <toredarell@gmail.com> wrote:
> On Jun 13, 8:15 am, Ramon Cahenzli <ramon.cahen...@gmail.com> wrote:
> > Foreero Ivan wrote:
> > > Please somebody can help me , I'm new with ruby , can anybdy tell me
> > > how use barby with PDF's documents ?
> >
> > It's not the only way, but if you're using Ruby FPDF, I've written a
> > small extension that can print Barby codes into FPDF-generated PDFs:
>
>
> Also, if you're using PDF::Writer, there's built-in support for that:
>
>
> require 'barby'
> require 'barby/outputter/pdfwriter_outputter'
>
> pdf = PDF::Writer.new
> barcode = Barby::Code128B.new('humbaba')
> barcode.annotate_pdf(pdf)
>
>
> The CairoOutputter can generate PDFs from scratch if you for some
> reason want that:
>
>
> require 'barby/outputter/cairo_outputter'
>
> File.open('test.pdf'){|f| f << barcode.to_pdf }
>
>
> In the git repo there's an experimental PrawnOutputter that can both
> annotate and generate PDFs using Prawn.
>
> Tore
>
>