barby icon indicating copy to clipboard operation
barby copied to clipboard

Barcode does not print numbers below barcode

Open RichardGrossman opened this issue 9 years ago • 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) %>

`

RichardGrossman avatar Apr 03 '17 04:04 RichardGrossman

screen shot 2017-04-02 at 9 22 28 pm

RichardGrossman avatar Apr 03 '17 04:04 RichardGrossman

It's not supposed to.

toretore avatar Apr 03 '17 08:04 toretore

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? ( '' )

RichardGrossman avatar Apr 04 '17 04:04 RichardGrossman