How to connect web and printer using wampserver2?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Marjun Sequera
    New Member
    • Jan 2011
    • 2

    How to connect web and printer using wampserver2?

    I want my page to be capable of printing data the user inputted in the page to a local printer. This is for our project. Please do help me. thank you.
  • Sudaraka
    New Member
    • Jan 2011
    • 55

    #2
    Printing is a built in functionality of the web browser you use, and unlike in a desktop application you don't need to worry about the technical functionality of printing here. Just select File > Print and it will take care of the rest (given that your system is setup properly for printing).

    However, you need to make your web pages out put print compatible.
    First thing you will need is a two set of CSS because you will need to style the page differently when printing. This can be easily done by using CSS media type. Your either define
    Code:
    $media print{
    }
    block in your CSS, or you can include a separate style sheet targeted for print media.
    Code:
    <link href="style.css" rel="stylesheet" type="text/css" media="all" /> <!-- CSS for all (screen display + printing) -->
    <link href="print.css" rel="stylesheet" type="text/css" media="print" /> <!-- CSS for printing only -->
    For more details see w3schools article "CSS Media Types" on this.

    Another thing is, you should have a fluid HTML layout in your web page, meaning you should design the page layout using DIV tags instead of TABLEs.
    For a single (print) page this will not make a different, but TABLE layout designs give you unpredictable results in where page breaks should occur.

    Speaking of page breaks, you should use them wisely. Making sure that page breaks doesn't occur with in block elements, floated elements or elements with borders is very important otherwise browsers might ignore them completely and it will result in missing pages in the print.
    Page breaks also doesn't work in absolutely positioned elements.
    More details can be found in this "CSS page-break-after" w3schools article.

    Comment

    Working...