Background images using prawn on all pages
问题 I have this code in the view prawn_document(:page_size=> "A4", :top_margin => 80, :bottom_margin => 40, :background => "public/uploads/1.png") do |pdf| creation_date = Time.now.strftime('%d-%m-%Y') posts = @posts.each do |post| pdf.pad(10) do pdf.text post.title pdf.text post.text end end pdf.page_count.times do |i| pdf.go_to_page(i + 1) pdf.draw_text "Creation Date : " + creation_date, :at => [200, 780] pdf.draw_text "Page : #{i + 1} / #{pdf.page_count}", :at => [450, -3] end end This gives