# Letting users print a portion of a view

**URL:** <https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956>\
**Category:** Rails\
**Created:** [January 4, 2008, 1:15am UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956 "2008-01-04T01:15:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@tomn](https://www.ruby-forum.com/u/tomn)\
**Post date:** [January 4, 2008, 1:15am UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956/1 "2008-01-04T01:15:46Z")

</div>

Any good tips on having a section of a view made printable in a cross  
browser manner?

I’ll have a table with data and formating (data-dependent background  
colors, tiny images before and after text data in cells) which is at the  
core of my application. Users, after working with their data through  
my application will want a printed copy to carry away with them. (its  
basically a scheduling application).

The print button on Firefox seems to want to default to text only with  
different font etc. It seems to me that what I almost want is an entire  
div including the table turned into an image (rasterized?) and put a  
print image button? Some sort of direction to a browser to print a  
portion of a page including all formating would also work (I’d imagine  
I’d need to test for browser type and give varrying instructions).

Sorry if this question isn’t necessarily a rails question(if there is no  
uniquely rails solution).

---

<div class="post-metadata">

**Author:** ![tomn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@tomn](https://www.ruby-forum.com/u/tomn)\
**Post date:** [January 4, 2008, 1:23am UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956/2 "2008-01-04T01:23:59Z")

</div>

You can define a print-only stylesheet. That’s the absolute simplest  
way.  
You can then use that stylesheet to hide sections of the page you don’t  
want  
to be printed. Look into that via the Google. 🙂

---

<div class="post-metadata">

**Author:** ![tomn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@tomn](https://www.ruby-forum.com/u/tomn)\
**Post date:** [January 4, 2008, 4:18am UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956/3 "2008-01-04T04:18:05Z")

</div>

Brian H. wrote:

> You can define a print-only stylesheet. That’s the absolute simplest  
> way.  
> You can then use that stylesheet to hide sections of the page you don’t  
> want  
> to be printed. Look into that via the Google. 🙂

Thanks for pointing me in the right direction.

I really need to find a comprehensive and well written CSS book as the  
online stuff I’ve found really is spotty.

---

<div class="post-metadata">

**Author:** ![tomn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@tomn](https://www.ruby-forum.com/u/tomn)\
**Post date:** [January 4, 2008, 4:27am UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956/4 "2008-01-04T04:27:30Z")

</div>

Check out some of the archives at [alistapart.com](http://alistapart.com) as they have wonderful  
CSS  
and web design articles, including some on printing.

---

<div class="post-metadata">

**Author:** ![tomn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@tomn](https://www.ruby-forum.com/u/tomn)\
**Post date:** [January 14, 2008, 9:55pm UTC](https://www.ruby-forum.com/t/letting-users-print-a-portion-of-a-view/124956/5 "2008-01-14T21:55:11Z")

</div>

Here’s a list of some good CSS books:

[http://www.buildingwebapps.com/books/list?category=33](http://www.buildingwebapps.com/books/list?category=33)

Michael S.  
[www.BuildingWebApps.com](http://www.BuildingWebApps.com)
