ruby-on-rails-3 – 使用Wicked_PDF(wkhtmltopdf)在PDF中嵌入SVG
发布时间:2020-12-17 03:59:34 所属栏目:百科 来源:网络整理
导读:当我尝试在由wicked_pdf(wkhtmltopdf)生成的PDF中包含SVG时,它会显示为空白.知道如何让svg在pdf中显示吗? 应用程序/视图/条码/ to_pdf.html.haml descriptive text here%object#code_image{:data="/barcodes/generate_svg?code=4567898",:type="image/svg+x
当我尝试在由wicked_pdf(wkhtmltopdf)生成的PDF中包含SVG时,它会显示为空白.知道如何让svg在pdf中显示吗?
应用程序/视图/条码/ 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 解决方法
我使用这种嵌入SVG的方法让它工作.
Display Inline SVG Using the Tag 更换 "data:image/svg+xml;base64,PD94bWwgdmVy..." 同 "data:image/svg+xml;base64,#{Base64.encode64(barcode.to_svg)}" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- NoSQL介绍
- postgresql – PostgresApp上的pghero pg_stat_statements必
- Flash player 11新增的Drawing API
- Flex中AdvancedDataGrid上的TreeColumn的ItemRenderer
- objective-c – 如何在OS X中调试屏幕保护程序
- 编写XML文档的时候可能犯的错误
- flash – video.js – 控件不在IE8中显示
- ruby-on-rails – 如何使用RSpec测试ActiveRecord回调?
- iPhone上应用程序的内存占用量
- Compile Swift 4.0-dev on CentOS7.2