How can I add page numbers to PDFKit generated PDFs?

Satchel picture Satchel · Feb 17, 2011 · Viewed 8.9k times · Source

I have multiple pages generated using PDFKit. How can I add page numbers to the bottom?

Answer

libo meyers picture libo meyers · Jun 10, 2011
PDFKit.configure do |config|
  config.default_options = {
    header_right: "Page [page] of [toPage]"
  }
end

kit = PDFKit.new(body_html)

Read all detailed documentation here:
http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html

PDFKit is just a wrap up for wkhtmltopdf application that is written in C.