当我尝试在由 wicked_pdf (wkhtmltopdf) 生成的 PDF 中包含 SVG 时,它显示为空白。知道如何让 svg 显示在 pdf 中吗?
app/views/barcodes/to_pdf.html.haml
<descriptive text here>
%object#code_image{:data=>"/barcodes/generate_svg?code=4567898", :type=>"image/svg+xml", :height=>70}
条码控制器
def generate_svg
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/svg_outputter'
barcode = Barby::Code128B.new(params[:code])
render :text => barcode.to_svg({:height=>30, :width => 170})
end
def to_pdf
render :pdf => 'file_name'
end