wicked_pdf将灰色框添加到pdf

时间:2014-10-28 17:15:57

标签: ruby-on-rails wkhtmltopdf wicked-pdf

您可以在下图中看到问题。这是我的代码:

  def show
    respond_to do |format|
      format.html { render :layout => false }
      format.pdf do
        render  :pdf =>             "Ticket",
                :no_background =>   true,
                :layout =>          false
      end
    end
  end

Show.pdf.erb 包含一行:hello

enter image description here

2 个答案:

答案 0 :(得分:1)

我需要创建正确的HTML格式才能使其正常工作。

<!doctype html>
<html>
  <head>
    <meta charset='utf-8' />

  </head>
  <body style="background-color:white;">
    <div id="header">
      header
    </div>
    <div id="content">
      hello
    </div>
  </body>
</html>

答案 1 :(得分:0)

添加到您的css:

@media print {  
    body { background-color: #FFF; }  
}
相关问题