0
我只是將我的應用程序升級到rails 5,並且gem wicked pdf
不再顯示css。我什麼都沒有改變,因此很可能會出現一些規格與軌道5 如果有人搞清楚這個問題隨時幫助:)Gem wicked pdf - CSS無法使用rails 5
這裏是我的代碼:
object_controller
def download
@object = object.find(params[:object])
respond_to do |format|
format.html
format.pdf do
render pdf: "ptf_#{@object.id}",
layout: 'layouts/pdf_layout',
template: 'objects/download.html.erb',
title: "download object",
show_as_html: false,
header: { content: render_to_string(template: 'objects/header_pdf.pdf.erb'), spacing: 7 },
footer: { content: render_to_string(template: 'objects/footer_pdf.pdf.erb'), spacing: 10 },
margin: { top: 55, bottom: 35 }
end
end
pdf_layout.html.erb
<% content_for :title do %><%= @title %><% end %>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<%= wicked_pdf_stylesheet_link_tag 'pdf' %>
<br>
<%= yield %>
我試圖與這兩個幫手wicked_pdf_stylesheet_link_tag
和stylesheet_link_tag wicked_pdf_asset_base64
header_pdf.html.erb
<div class="center">
<%= image_tag wicked_pdf_asset_base64("logo.png"), class: 'header' %>
<div class="first-class"><%= @object.title %></div>
</div>
這是我的代碼的一些提取物只是爲了告訴我如何組織我的文件生成。我也有一個文件pdf.scss
正是!而CSS現在很好 – Orsay