Web Reference
Printing Webpages
Frequently Asked Questions

  • Is it possible to print from a link on my page?
  • Is it possible to force a page break?
  • Are there any standard html rules for printing?
  • Why should I avoid using graphics wider than 550 pixels?Why do my gifs look so bad on paper?
  • Can I just link a Microsoft Suite files (Word/Excel files)?
  • I have light text over dark background and when I print my page I can't see this text. How can I print this text properly?
  • Why doesn't an image on the screen print out?
  • How to make sure only specific frame would print from a frameset?
  • How to print only specific content from the page?


  • What are the recommendations when creating an HTML printable version?

  • What about PDF?

    Is it possible to print from a link on my page?
    Yes, by using a JavaScript method called window.print . However this method is not supported by all browser settings. See example.
    top

    Is it possible to force a page break?
    Yes, by using Cascading Style Sheets. Define in your style sheet "page-break-before: always" or "page-break-after: always". However this method is not supported by all browser ( It works in IE 5.5. It does not work in Netscape 6). See example.
    top

    Are there any standard html rules for printing?
    Nope! This is the main reason this FAQ exists.
    CSS2 supports print, but CSS2 is not supported fully by any browser (to date).
    top

    Why should I avoid using graphics wider than 550 pixels?
    If the browser/printer setting produce narrower page than your graphics the image will get cut and the remainder might print on extra sheets.
    top

    Why do my gifs look so bad on paper?
    The normal image resolution for gifs is 72 Dots Per Inch (DPI= 1 pixel on screen), while the normal resolution for images created for print is 300 DPI or better.
    You can save your images in some other format, but file size will increase dramatically.
    top

    Can I just link a Microsoft Suite files (Word/Excel files)?
    Yes. All you need to do is provide a normal link to that file. However, it is possible that your users don't have these programs/versions.
    top

    I have light text over dark background and when I print my page I can't see this text. How can I print this text properly?
    You can use a special CSS code for printed media, however this solution is part of CSS2 and is not supported properly by most browsers. See example.
    top

    Why doesn't an image on the screen print out?
    There are several explanations:
  • Your browser/printer are set to "do not print images".
  • The image you see on screen is a background image and your browser/printer are set to "do not print background images".
    top

    How to make sure only specific frame would print from a frameset?
    Frames are tricky because the visitor has to "be" in the frame intended to print by having the cursor in the frame (click the mouse/enter while in the frame).
    On the other hand the advantage to frames is that you can provide a link to "printable version" which will be a new window with only the "right" frame's content. The link should point to the same page. Make sure to specify the target to _blank or _top to break out of the frameset. See example.
    top

    How to print only specific content from the page?
    Use Cascading Style Sheet to print specific content and hide certain content by specifying different behaviors according to the media. Define in your style sheet a specific class for cotnent you wish to hide when printing by stating
    @media print {
        .dontPrintMe{display : none;}
        }
    However this method is not supported by all browsers ( It works in browser version 4 and up in most browsers). See: example.
    top



    What are the recommendations when creating an HTML printable version?
    If you expect a page to be printed often, create a seperate version.
    1. Avoid nesting tables! Under certain circumstances the printed page will break after each table break.
    2. Graphics width should be under 550 pixels. See the results of my experiment.
    3. If you have to set a table width, define it in percentages.
    4. Avoid using background images. The default on most browsers will be to ignore background images.

    top



    Send questions to: lily@akalg.com

    Last updated: November 2000

    Special thanks to the wonderful people on SFWOW and SVW that contributed immensely to this FAQ by asking and answering most of these questions.






                                                                                                                                                                                                                                                                                                                                                                                                    
  •