What is the best way to generate barcodes from strings in a rails app? After displaying the codes in a view I also would like to print them to a pdf file.
Thank you
I wanted to write this as a comment to idlefingers' answer, but apparently I don't have enough reputation to do that, so I'll write it here instead.
If you're creating PDFs you can use Barby to render the barcode directly into the PDF file instead of creating an image first:
require 'barby/outputter/prawn_outputter'
#aPdf is a Prawn::Document, aBarcode is a Barby::Barcode
aBarcode.annotate_pdf(aPdf, :x => 100, :y => 100)
There's also a PdfWriterOutputter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.