#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    7
    Rep Power
    0

    Printing a page opened with javascript


    Hi

    I'm opening a blank page & then writing to it with javascript

    var printTxt = 'my string';
    var printablePage = open('blank.htm', 'printablePage', '');
    printablePage.document.write(printTxt);

    Basically, printTxt is a hugely stripped down version of the origional page for printing.

    Thing is, if i try to print the opened page, it actually prints the origional page. Very frustrating.

    Can anybody offer any advice?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    buggy browser... update!

    it is sad, but afaik you canīt print html pages reliably at all... unless you use some very browser- and os-specific code.

    my experience is: you canīt print. IE (5, 5.5, 6.0, 6.0SP1) does not even print all pages that i view on the web (GPF!). And if it does, it will screw up everything unless they used html3.2 compatible code. still then, some elements are not printed correctly
    Last edited by M.Hirsch; January 21st, 2003 at 02:58 PM.
  4. #3
  5. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    ... if this actually does help (and also works for most browsers), the other problems are still there. as i told, when i try to print arbitrary pages from google, IE segfaults (on my XP Home SP1, on my XP pro without SP and on my W2K/IE5.x (the one that came with MSOffice 2KSP1) or sometimes only prints half of the content
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    7
    Rep Power
    0
    thanks for all your help

    solution seems to work ok

IMN logo majestic logo threadwatch logo seochat tools logo