wicked_pdf: Is it possible to have the header only show on the first page & the footer only on the last?

前端 未结 2 526
慢半拍i
慢半拍i 2020-12-18 14:37

Right now I have :header => {:html => {:template => \"layouts/pdf_header.html.erb\"}} setting things up. Is there something I can pass in that will on

2条回答
  •  忘掉有多难
    2020-12-18 15:11

    Add layout when rendering pdf

    format.pdf do
      render :pdf => "my_pdf",
      :layout => 'pdf
    end
    

    views/layouts/pdf.haml

    %html
      %head
    
      %body
        = render "layouts/header"
        = yield
        = render "layouts/footer"
    

提交回复
热议问题