0
votes

I'm trying to render a Barcode on the show action using Barby on a PDF, but it's not showing the barcode in visual aspects. new_barcode_pdf is active and returns: 4000000000297

The code i'm using in my controller:

@barcode = Barcode.find(params[:id]).barcode_number

@new_barcode_pdf = Barby::EAN13.new(@barcode)
@barcode_pdf = Barby::HtmlOutputter.new(@new_barcode_pdf)
@new_barcode_pdf.to_html

respond_to do |format|
  format.html
  format.pdf do
    render :pdf => "pdf layout", :layout => 'show.pdf.erb', encoding: 'utf8'
  end
end

And in my view:

<%= @new_barcode_pdf.to_html.html_safe %>

I'm using WickedPdf to render the barcode.

Thanks in advance,

K.

1

1 Answers

0
votes

I figured out what the problem was, the PDF itself requires to have the CSS inside the same PDF file.