Web Analytics Made Easy -
StatCounter Printing - CodingForum

Announcement

Collapse
No announcement yet.

Printing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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.
    De gustibus non est disputandum.

    Comment


    • #3
      <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
      "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

      Comment


      • #4
        Hi

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

        Comment


        • #5
          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();
          }
          Having said that, I've probably told you more than I know.

          Comment


          • #6
            Thanks Jalarie for your solution which I will try out

            Comment

            Working...
            X