我正在创建一本pdf书,我需要为每个页面添加背景图像.
页面尺寸为(576 x 576),背景图像尺寸为2700 x 2700(300 dpi.)(这些尺寸是要求,因此无法调整).我的问题是 - 背景图片在页面中显示不成比例.我怎样才能解决这个问题 ?这是我的代码:
Prawn::Document.generate("#{Rails.root.to_s}/public/#{filename}.pdf", :page_size => [576,576], :left_margin => 50,
:right_margin => 50, :page_layout => :portrait, :skip_page_creation => true, :skip_encoding => true,
:background => "#{Rails.root.to_s}/public/images/pdf/bg_blank_low.jpg" ) do |pdf|
....
....
....
)
Run Code Online (Sandbox Code Playgroud)
有没有其他方法可以将300 dpi的图像作为背景图像放置.
我甚至尝试添加pdf模板作为背景,但仍然没有运气.
任何建议或提示将不胜感激.
谢谢.
我正在使用paperclip在我的应用中上传图片.验证我是:
validates_attachment_content_type :image, :content_type => ['image/jpg','image/jpeg', 'image/png', 'image/tiff', 'image/gif']
Run Code Online (Sandbox Code Playgroud)
一切都适用于firefox,chorme和IE9.但在IE8中,我收到一个错误 - " 照片图像内容类型无效格式!!! "
任何解决方案或线索都非常感谢.
我需要按照传入的确切顺序查找记录作为搜索参数.
例如,我有一个字符串:
item_list = "23,12,54,45"
Run Code Online (Sandbox Code Playgroud)
通过以下查询,我以"item_list" - "12,23,45,54"的asc顺序获取记录.
Inventory.find(item_list.split(","))
Run Code Online (Sandbox Code Playgroud)
如何修改上述查询,使其以"item_list"的相同顺序返回记录.
谢谢.
我正在尝试通过Restclient的http POST请求将xml发送到另一个Web服务器.这是代码:
response = RestClient.post 'https://secure.rowebooks.co.uk/testorders/orders.aspx', :content_type => "text/xml", :myfile => File.read("#{Rails.root}/public/shared/#{@book}.xml")
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误
ERROR 2 Data at the root level is invalid. Line 1, position 1.ERROR3 Object reference not set to an instance of an object.
Run Code Online (Sandbox Code Playgroud)
我被告知我收到该错误,因为XML文件不在调用的内容中.它必须在内容中.我不知道这是什么意思.
任何建议/线索将不胜感激.
谢谢