Printing Issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    Printing Issues

    Hi there,

    I'm currently attempting to print a web-page at the end of a lengthy registration process.

    The script I'm using is quite simple:

    <body onload="window. print(); window.close(); ">

    IE works perfectly and does what I would expect it to do. The problem I'm having is with Firefox 2.0: It will only print the first page of the web-page.

    Apparently the browser is closing before it finishes the printing process (or that's what I'm assuming happens since when I leave the window open, it prints perfectly fine).

    I read through a discussion posted here in the past about a similar issue to the one I'm having but didn't find it helpful for solving the problem.

    There was a lot of talk about using CSS2 to create a CSS used for printing...but I simply want to print what I have customized the document to look like (since its very different from the web-page) and then want to close the window afterwards.

    I'm wondering if anyone knows the reason why only one page is printing in Firefox? And if anyone knows of a way to get around this without leaving the window open after the print dialog has been closed ?

    Thanks a lot for your help
    -F
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    There's not much control of printing using JavaScript. You could try closing the window onfocus assuming that the window would receive focus after the print dialog has closed, but that wouldn't be reliable.
    Originally posted by Frinavale
    ...but I simply want to print what I have customized the document to look like (since its very different from the web-page) and then want to close the window afterwards.
    CSS is the way to go really. The whole point is you would style it differently depending on the media (screen, print, etc.). If you can customize it to look how you want it to using CSS, you don't need to open a print-friendly popup window.

    Comment

    Working...