Bryant Hankins
Bryant Hankins

Reputation: 365

Best way to make a printer-friendly ASP.NET page?

I'm just curious how most people make their ASP.NET pages printer-friendly? Do you create a separate printer-friendly version of the ASPX page, use CSS or something else? How do you handle situations like page breaks and wide tables?

Is there one elegant solution that works for the majority of the cases?

Upvotes: 8

Views: 7582

Answers (3)

Ian Nelson
Ian Nelson

Reputation: 58703

Our gracious host wrote a good blog post on this topic:

Coding Horror: Stylesheets for Print and Handheld

Upvotes: 6

Ryan Farley
Ryan Farley

Reputation: 11421

You basically make another CSS file that hide things or gives simpler "printer-friendly" style to things then add that with a media="print" so that it only applies to print media (when it is printed)

<link rel="stylesheet" type="text/css" media="print" href="print.css" />

Upvotes: 14

Alexander Morland
Alexander Morland

Reputation: 6434

I am a php user, but the point must be that the result no matter what is HTML and HTML is styled with CSS and there is an option for your style sheets for just using the style for printing. This should be the way to do it, imho. About big tables, there isnt really a magic "fix" for that. Page will break where it breaks, dont really understand the problem here either.

<link rel="stylesheet" type="text/css" media="print" href="print.css" /> 
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />

Upvotes: 0

Related Questions