1

Is it possible to get wicked-pdf to render different footers of a single multipage document? So page 1 would have a footer that says one thing and page 2 would have a footer that says another thing.

BeeZee
  • 1,572
  • 21
  • 25

2 Answers2

1

If you check the example here for custom page numbering with javascript:

https://github.com/mileszs/wicked_pdf#page-numbering

You should be able to write some javascript logic to say if page > 1, then do something special.

Another way would be to use WickedPdf.new.pdf_from_string to build your page 1 pdf, then the rest of the document in another pdf_from_string, and use PDFtk to stitch them together.

Unixmonkey
  • 18,485
  • 7
  • 55
  • 78
  • Is there a certain point when footer elements are available on the DOM? I've been debugging with some simple javascript, but it seems that it's running before the footer is inserted into the DOM. Thanks. – ryan508 Dec 08 '12 at 00:50
  • Is this valid also with headers? For example if I want a different render for headers in odd / even pages? How would you do that? – unmultimedio Oct 07 '15 at 14:28
  • 1
    Neverming, I just found that answer here: http://stackoverflow.com/a/13689364/1755300 – unmultimedio Oct 07 '15 at 14:35
0

For doing such thing I think it's better to use Partial Files!Then in the main Page you can Specify width,heights and use <%= yield %> or <%= rende 'partial_file' %>. Break a Leg :)

Afsanefda
  • 3,069
  • 6
  • 36
  • 76