Forum: Ruby on Rails Printable Version of a Page

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2808b5c359edcb77ec783e3793c8d381?d=identicon&s=25 Rafael (Guest)
on 2007-07-05 13:58
(Received via mailing list)
Hi everybody,

may somebody has already an aproach and could help me?

I have a app (REST Design) and what I would like to have is a link
like "print page"
where the actual view can be displayed in a popup and another layout.

Does anybody has a clue, whats the best way to implement this?

Thank you very much!

kind regards

A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 R. Elliott Mason (eleo)
on 2007-07-05 14:10
I think a different stylesheet would make the most sense.  Make a CSS
stylesheet that is simplified: white background, black text, any
menus/ads/etc hidden (using display: hidden or something along those
lines.)  You should be able to do this without directly involving rails.
2808b5c359edcb77ec783e3793c8d381?d=identicon&s=25 beYou media { Rafael Schär } (Guest)
on 2007-07-05 14:16
(Received via mailing list)
Hey Elliot, thanks a lot

would you send it like this

and then make a condition for the params in the layout?

Am 05.07.2007 um 14:10 schrieb R. Elliott Mason:
A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 R. Elliott Mason (eleo)
on 2007-07-05 14:23
34a7615f38496a5dafbb3e6b721c435e?d=identicon&s=25 Mohit Sindhwani (Guest)
on 2007-07-06 06:20
(Received via mailing list)
beYou media { Rafael Schär } wrote:

Hi, I just want to add one thing to the solution.

I don't know about browser support but it should be possible to specify
both the stylesheets with the media attribute set to "screen" and
"print" (I think) and the browser is supposed to pick up the correct one
when it displays/ prints.

That way, you don't have to worry about things like
"" and you don't need to re-generate the
page (specially since you've already done the hard work of searching the
DB and rendering the page) - everything is done in the browser itself.

You may need to check on browser support for this - I know Firefox
supports this for sure and I expect Opera does too.  I wouldn't be
surprised if IE 7.0 also has proper support for this.

Take a look at this page for an example.. you'll see that in the screen
mode, you get to see the menus but when you do a print preview, the page
cleans up:

7/6/2007 | 12:11 PM.
This topic is locked and can not be replied to.