How can I make the page to be Printer Friendly?

admin

Administrator
Staff member
Hi<br />
I need to make the html page to be printer friendly, i.e I want it to be easy to be printed on A4 printer.:confused: Is there rules to do that? I want to get this with no several time of try.:(<!--content-->If you are using CSS on your page to create your layout you might also simply provide an alternative stylesheet optimized for printing, using a similar technique<br />
<br />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"main.css" rel="stylesheet" type="text/css" media="screen"><br />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"print.css" rel="stylesheet" type="text/css" media="print"><br />
<br />
The main benefit of the CSS approach is that the file with the content will always be 100% in sync with the webpage as it is litterally the same file.<br />
You also usually end up with smaller Download <!--more--> sizes sine you don't have to repeat the entire content of the page.<br />
<br />
The disadvantage of CSS is that old buggy browsers (NS & IE 4 and older) have problems understanding whats going on. However these browsers is a small section of the browsers in use and get fewer all the time as people upgrade.<!--content-->Ok, I need to know how to implement your advices into code what wiil be coded inside the linked css file? and the printed document(for dave repy) how can I create it.<br />
Regards:(<!--content-->Originally posted by said_fox <br />
Ok, I need to know how to implement your advices into code what wiil be coded inside the linked css file? <br />
<br />
<br />
Obviously that depends very much on your site layout, but some general recomendations for a print.css is:<br />
<br />
* Use black text on white background<br />
* Remove all backgrounds<br />
* Remove unneccesary images/adds<br />
* Use a serif font (eg times new roman)<br />
* Use units apropriate to a real world enviroment (eg sizes in inch or mm and fontsizes in points instead of % or pixel).<br />
<br />
In advanced browsers you can also automatically show eg the href attribute in plaintext of all your links on the printed version.<br />
<br />
<br />
and the printed document(for dave repy) how can I create it.<br />
<br />
<br />
The normal way to make a document. For a .doc you would need eg word.<!--content-->I would avoid, however, publishing a Microsoft Word documet. It's too prone to viri and it's too platform dependent. I like to use Portable Document Format (PDF) for my printer friendly versions, but you might find it easier to use Rich Text Format (RTF). Do up a version in MS Word but save it as RTF. Then your LINK element should look something like:<br />
<br />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"printVersion.rtf" media="Print" rel="Alternate" type="text/rtf"><!--content-->All replys are useful, but this when the page contents are static, so suppose the page contents are dynamic. e.g a shoping cart or Billing results in a web application.<br />
or suppose this, a web application produces a table has 400 record or row, this result to be printed on A4, it's imposible to make the 400 row to be displayed in the same page. so they must be divided into 25 row per page plus the table heading in each page. Doing this using web application is easy, but to make sure that the printer will print each 25 row and their heading in one A4 papper this's the problem which I need help for it. So how we implement that.<br />
I hope my explanation is clear.<br />
Please help<br />
Regards<!--content-->Keeping with Stefan's fine method, you could employ page breaks with CSS (<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-CSS2/page.html#page-breaks">http://www.w3.org/TR/REC-CSS2/page.html#page-breaks</a><!-- m -->). Or, keeping with my suggestion you could run FOP on the server, or just the parts that you need, and produce a PDF version on the fly. (<!-- m --><a class="postlink" href="http://xml.apache.org/fop/index.html">http://xml.apache.org/fop/index.html</a><!-- m -->)<!--content-->Originally posted by said_fox <br />
e.g a shoping cart or Billing results in a web application.<br />
<br />
<br />
Seeing that this is buziness related and involving money I would recomend Charles FOP suggestion over CSS, since CSS has the weakness of relying on clientside technology (might break in visitors browsers).<br />
<br />
For a real buziness solution you want to do this serverside.<!--content-->But FOP is written in Java, so you would have to get a Java interpeter up and running on the server and you'll need to know a good bit of Java to get it integrated with your form handling script. And to that end you would do best to re-write your form handler in Java. You might want to stick with CSS.<!--content-->
 
Back
Top