Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Printer Friendly Website Script

  1. #1
    Senior Member
    Join Date
    Jul 2004
    Posts
    131

    Printer Friendly Website Script

    Hi guys, I'm looking for a script that when the user clicks a print icon, a printer friendly version will be shown that will allow the user to print the page successfully on letter size paper.

    I'm using a tableless design with DIV tags and CSS, so I was thinking all I need to do is remove the stylesheet from each page. Is this the best way to go? Do you have any other ideas?

  2. #2
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    The easiest option is to just create a style sheet for the print, http://alistapart.com/articles/goingtoprint/

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Posts
    131
    Thanks Speed that is exactly what I was looking for!

  4. #4
    Junior Member
    Join Date
    Oct 2005
    Posts
    8
    You might also consider creating a PDF file for the user to download.

  5. #5
    Senior Member
    Join Date
    Jul 2004
    Posts
    131
    OK scratch that, I'm having some trouble getting this print thing to work properly. Basically my webpage is 900px wide, with a 200px sidebar on the left. I'm making all the images, menus, and sidebar with the display:none property with no problems. The problem is that the text is not wrapping properly, several words get cut off and if I decrease the font I just can fit more words on the line but it still gets cut off! grrrrrrr

    My CSS is pretty complicated, I have a mix of relative and absolute DIVs to achieve the look that my company wants. Any advice?

  6. #6
    Junior Member
    Join Date
    Sep 2003
    Posts
    21
    It's easy - for print pages, I create a "print" style sheet in addition to the "screen" media style page. Usually, I make a copy of the screen style page. And, I set "display:none" for any elements that I don't want on the printed page, such as the navigation bar. I also make minor adjustments in the width(s) to make the content fit a printed page. For example, I make certain the page size fits the dimensions of a print page (around 660px in width for a portrait page).

    You've indicated that your web pages are 900px, which means some of your text will not fit on a print page in portrait format. The result is some of the text is "cut off". I don't have your CSS style sheet to confirm my guess, but I suspect you need to reset the widths to fit the typical print page (around 660px).

    You should find it fairly easy to tailor the screen style sheet to create a print style sheet, with a few changes.

    Ron Baker
    www.apex-systems.net
    www.hilton-head-property.com
    www.hilton-head-real-estate.biz

  7. #7
    Senior Member DrTandem1's Avatar
    Join Date
    Oct 2003
    Posts
    1,828
    Your web page and your printer-friendly page should be from separate sources. As someone mentioned, converting it to a PDF is a good option.

    You need to realize that the print world is far different from the virtual world.
    DrTandem's San Diego Web Page Design, drtandem.com

  8. #8
    Junior Member
    Join Date
    Jun 2006
    Posts
    14

    Re: Printer Friendly Website Script

    Quote Originally Posted by spenland
    Hi guys, I'm looking for a script that when the user clicks a print icon, a printer friendly version will be shown that will allow the user to print the page successfully on letter size paper.

    I'm using a tableless design with DIV tags and CSS, so I was thinking all I need to do is remove the stylesheet from each page. Is this the best way to go? Do you have any other ideas?
    ++++++++++++++++
    Another thought would be to use 3 pages. A Server-Side Include page with the text, a Style 1 page with the SSI page that would display the way you want for your site layout, and a Style 2 page with the same SSI page with CSS set just for printing. That way you make text changes to the SSI page and never have to touch the layout for either...

  9. #9
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    Quote Originally Posted by spenland
    OK scratch that, I'm having some trouble getting this print thing to work properly. Basically my webpage is 900px wide, with a 200px sidebar on the left. I'm making all the images, menus, and sidebar with the display:none property with no problems. The problem is that the text is not wrapping properly, several words get cut off and if I decrease the font I just can fit more words on the line but it still gets cut off! grrrrrrr

    My CSS is pretty complicated, I have a mix of relative and absolute DIVs to achieve the look that my company wants. Any advice?
    Assuming printing the web page is still what you want to do, without seeing the page in question it's hard to be specific, but as well as using display: none for the bit's you don't want, also change your containers width from 900px to 90%.

    Using a % width should make the text wrap to fit but this does depend on what else you have on the page, i.e. a 900px wide image will probably scupper this.

    Do you need to absolutely positioned items on the print version? I'm guessing you could leave them in the flow as in your first post you mentioned just removing the style sheet?

  10. #10
    WebProWorld MVP TrafficProducer's Avatar
    Join Date
    Jul 2003
    Posts
    1,958

    Print out , Hard copy, code Javascript

    Print out , Hard copy, code Javascript, Just do the page as-is)

    Code:
    To Print: <a href="javascript:if (window.print != null) { window.print(); }
     else { alert('Your browser does not support this method of printing.
     Please select Print/File from your Browser Menu.'); }">Click here</a>
     or Select File/Print from your Browser Menu.
    PDF could mean they keep a harddrive copy, pass-it on, (Viral Marketing) as well.

Page 1 of 2 12 LastLast

Similar Threads

  1. How to know that a website is SEO friendly?
    By montyauto in forum Search Engine Optimization Forum
    Replies: 1
    Last Post: 01-07-2007, 12:59 PM
  2. Recommended search engine friendly image gallery script ?
    By funlounge in forum Search Engine Optimization Forum
    Replies: 3
    Last Post: 06-10-2006, 01:08 AM
  3. SE friendly, Joke and ratemypic (hot or not) script?
    By suthra in forum Web Programming Discussion Forum
    Replies: 0
    Last Post: 06-28-2005, 02:00 AM
  4. Printer friendly page?
    By steve-parrott in forum Graphics & Design Discussion Forum
    Replies: 5
    Last Post: 08-31-2004, 03:48 AM
  5. Why aren't printer friendly pages picked up as spam?
    By littlegiant in forum Google Discussion Forum
    Replies: 13
    Last Post: 05-04-2004, 08:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •