#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    New Zealand
    Posts
    167
    Rep Power
    14

    Question Javascript Print without page headers or footers


    Does anyone know how to use JS to print a page without headers/footers?

    At the moment, I have a button that uses a js function to print out the current page. However, the page prints out with the URL address on the top and another string of text on the bottom.

    As I understand it, this is a browser setting under the File-Page Setup menu. Can I affect these settings on a user's machine, or is there a work-around for this?

    Any tips would be greatly appreciated.

    Cheers,

    Jen
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Wilmslow, Cheshire
    Posts
    255
    Rep Power
    18
    As far as I'm aware, the only 'control' you might have over printing from a browser is in setting page breaks in IE4+ (ie telling the printer where to start a new page). The header & footer settings are local, as you said, along with landscape/portrait and background colour/image settings. Someone else here could well know more though.

    For the record, although it's not what you asked , set page breaks:

    <DIV STYLE="page-break-before: always;">Start this DIV on new page</DIV>

    or

    <DIV STYLE="page-break-after: always;">Start new page after this DIV</DIV>

    Well, that might come in useful one day.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Florida, USA
    Posts
    18
    Rep Power
    0
    This isn't the answer to the original question either (I don't think those print settings can be suppressed), but it is related.

    There's more control than just page breaks available, if you use a stylesheet in the head and give it the attribute MEDIA="PRINT".

    You can have an entire different stylesheet for print in that case (no more "click here for printer-friendly version"), but the one thing that I find particularly useful is setting {display:none;} for certain elements (for instance, a 'Print This Page' button).
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    New Zealand
    Posts
    167
    Rep Power
    14

    Thanks!


    Thanks for that! Yeah, I was kind of grasping at straws a little - I figured I probably couldn't play with someone else's browser settings...

    I will play around with both the suggestions and see if I can get the printout looking a little nicer. Much appreciated.

    Cheers,

    Jen

IMN logo majestic logo threadwatch logo seochat tools logo