toretore/barby

Barcode does not print numbers below barcode

RichardGrossman opened this issue · 3 comments

`
APPLICATION CONTROLLER

class ApplicationController < ActionController::Base
require 'chunky_png'
require 'barby'
require 'barby/barcode/ean_13'
require 'barby/outputter/png_outputter'

def barcode_output(barstring)
barcode_string = barstring.to_s.rjust(12,"0")
barcode = Barby::EAN13.new(barcode_string)

# PNG OUTPUT
data           = barcode.to_image(height: 40, margin: 10).to_data_url

end
end

ACTION
class ClientsController < ApplicationController

def clientlist
@Clients = Client.all
@barcode = barcode_output('1234567')
respond_to do |format|
format.html
format.pdf do
render pdf: "clientlist",
template: 'clients/clientlist.html.erb',
show_as_html: params[:debug].present?,
locals: { :clients => @Clients },
outline: { outline: true,
outline_depth: 50 },
margin: { top: 10, # default 10 (mm)
bottom: 10,
left: 10,
right: 10 }
end
end
end

CLIENTLIST.HTML.ERB

Clients BARCODE



"<%= wicked_pdf_image_tag_for_public(@barcode) %>

`

It's not supposed to.

I saw that in a questuion, from 2009 but I wondered if that changed.
I can print the number below the barcode but there's no way I can interleave the leading 0 off to the left and the number to the right.

Any idea of where the two small extraneous lines are coming from at the bottom left? ( '' )