Minu
Minu

Reputation: 101

Enable header for first page only using pdfkit

I have added header using: %meta{:name => 'pdfkit-header_html', :content => pdf_header_url}

But I need header only on first page and not on the other pages. Also, I need different header_spacing on the first page and other pages. Please, suggest how to do this?

Upvotes: 1

Views: 568

Answers (1)

Minu
Minu

Reputation: 101

pdf.html

%html %head %meta{:name => 'pdfkit-header_html', :content => pdf_header_url }

Now in the pdf_header action the params[:page] will be available

def pdf_header if params[:page] == 1 render 'pdf_header' else render nothing: true end end

Upvotes: 1

Related Questions