Multi-page prints


#1

I am struggling with the concept of multi-page forms. I have a number of
forms all done in html and they look really good. I don’t see how html
can support page breaks for printed pages but perhaps there is a way to
do that. I haven’t spent all that much time on it and I do see that css
seems to have some commands for printing functions.

I was playing around with setting up loops in controller code and found
that I couldn’t use render => :action within the loop because ruby
complained (sensibly I suppose) that I couldn’t have multiple renders.

So I have installed the gem pdf-writer which is interesting but it has
it’s own markup language which means back to the drawing board and I
won’t have the tools that I have for html and I can’t see any method for
it to use the html forms that I’ve already created.

I’m wondering how other people handle printing…especially multiple
page forms - and even most specifically, multiple pages within a loop of
objects - i.e. pseudo code…
for product in @product
print page
end

Thanks

Craig


#2

Have you looked in to partials? While not the perfect solution they may
help.

Also CSS has a property called page-break that can set where pages break
when printing (not sure if it’s supported in all browsers) it might be
worth a look