# Printable Version of a Page

**URL:** <https://www.ruby-forum.com/t/printable-version-of-a-page/108625>\
**Category:** Rails\
**Created:** [July 5, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625 "2007-07-05T13:58:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.ruby-forum.com/u/rafael)\
**Post date:** [July 5, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625/1 "2007-07-05T13:58:09Z")

</div>

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

Rafael

---

<div class="post-metadata">

**Author:** ![rafael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.ruby-forum.com/u/rafael)\
**Post date:** [July 5, 2007, 2:10pm UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625/2 "2007-07-05T14:10:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rafael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.ruby-forum.com/u/rafael)\
**Post date:** [July 5, 2007, 2:23pm UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625/3 "2007-07-05T14:23:02Z")

</div>

Yup.

---

<div class="post-metadata">

**Author:** ![rafael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.ruby-forum.com/u/rafael)\
**Post date:** [July 6, 2007, 6:20am UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625/4 "2007-07-06T06:20:04Z")

</div>

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  
“[example.com/vacancies?view=print](http://example.com/vacancies?view=print)” 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:

> **[IBM Products](https://www.ibm.com/products?types%5B0%5D=software)**
>
> The place to shop for software, hardware and services from IBM and our providers. Browse by technologies, business needs and services.

Cheers,  
Mohit.  
7/6/2007 | 12:11 PM.

---

<div class="post-metadata">

**Author:** ![rafael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.ruby-forum.com/u/rafael)\
**Post date:** [July 5, 2007, 2:16pm UTC](https://www.ruby-forum.com/t/printable-version-of-a-page/108625/5 "2007-07-05T14:16:11Z")

</div>

Hey Elliot, thanks a lot

would you send it like this

[example.com/vacancies?view=print](http://example.com/vacancies?view=print)  
[example.com/vacancies/1234?view=print](http://example.com/vacancies/1234?view=print)

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

Am 05.07.2007 um 14:10 schrieb R. Elliott M.:
