weixin_39760650
2020-12-04 11:46Barcode 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
"
`
该提问来源于开源项目:toretore/barby
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 2D矩阵条形码在cakephp中的tcpdf供应商中为动态字符串生成错误的条形码
- barcode
- tcpdf
- php
- 1个回答
- WooCommerce:在可变产品页面中显示当前的SKU和GTIN
- sku
- barcode
- php
- 1个回答
- 强制打印只有1页
- javascript
- html
- printing
- php
- css
- 2个回答
- 使用gd库加载图像
- barcode
- assets
- php
- gd
- 1个回答
- 通过表单执行SQL插入时填充会话UserID
- sql
- session-variables
- php
- 1个回答