weixin_39760650
weixin_39760650
2020-12-04 11:46

Barcode does not print numbers below barcode

` 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 = Client.all = 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 => }, 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



"

`

该提问来源于开源项目:toretore/barby

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐

换一换