Click to open & print a page?

Discussion in 'Software' started by Morgan19, Sep 21, 2005.

  1. Morgan19

    Morgan19 Specialist

    I'm working on some simple printer-friendly pages for a site and, when a user clicks on the "Printer Friendly" icon, would like the new page to open the print dialog box automatically when it opens up (as if they'd hit File > Print themselves).

    What code would I need to implement to enable that type of auto-printing?

    m19
     
  2. spaz

    spaz Specialist

    What language are you writing? HTML?
    If so, I'm not sure there is an auto-print function..hm.. I'll look around.
    Also, it is likely you'll need to build your "print friendly" page for your users. There may be a way to generate it, but if you want it to look really tidy, you might wanna just pop the text into notepad and straighten it up and then save as a .txt file.

    This will also take care of any compatibility problems you might run across if you save it as .doc.

    Just some thoughts.
     
  3. Kodo

    Kodo SNATCHSQUATCH

    in the page put
    <script language="Javascript1.2">
    <!--

    function printWindow(){
    browserVersion = parseInt(navigator.appVersion)
    if (browserVersion >= 4) window.print()
    }

    // -->


    </script>
    have a link that says PRINT THIS PAGE
    <a href="javascript:printWindow()">Print This Page</a>
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds