Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Printing

  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing

    I would like to be able to print a selection of an HTML page rather than the whole page. is there a way to achieve this?
    Thanks for any help

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You would have to grab the desired elements and by some DHTML functionality and pass them to a new blank document, which you have opened in a new window or in a frame. Perhaps it's even possible to do this in a hidden <iframe>.
    Then you only have call the window.print() method of that new document.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <style type="text/css" media="screen">

    img { display:inline; }

    </style>
    <style type="text/css" media="print">

    img { display:none; }

    </style>


    This simple example will declare that all IMG tags do not print. By extending this method, you can specify any area of the page to print or not print

  • #4
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    Thanks guys for the help. I will look into these options

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Sel='';
    function PrintSelected() {
    if (window.frames.length == 0){
    Sel=document.getSelection();
    } else {
    for (iy=0;iy<window.frames.length;iy++){
    Fm=window.frames[iy];
    Sel=Sel+Fm.document.getSelection();
    }
    }
    var Opts='width=100,height=100'; PS_Pop=window.open('','PrintSel',Opts);
    PS_Pop.document.write(Sel);
    PS_Pop.document.close();
    this.window.focus();
    PS_Time=setTimeout("PrintSelected2()",1000);
    }
    function PrintSelected2() {
    PS_Pop.window.print();
    PS_Time=setTimeout("PrintSelected3()",5000);
    }
    function PrintSelected3() {
    PS_Pop.window.close();
    }

  • #6
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Jalarie for your solution which I will try out


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •