Web Analytics Made Easy -
StatCounter Print iFrame Content - CodingForum

Announcement

Collapse
No announcement yet.

Print iFrame Content

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Print iFrame Content

    Does anybody of u know how to print the content of an iFrame? The Content of the iFrame is just another HTML Page!!!

    Thanx and Cheers,
    Sepp

  • #2
    right click in the IFrame and select "Print"

    this will print the page inside the iframe.


    Alternately you could have a button that says "click here to print" or something like that... try this:

    In the page that's inside the iframe put this:

    Code:
    <a href="#" onClick="print(); return false;">click here to print this page</a>
    that should work.

    Comment


    • #3
      reply

      don't want to put it INSIDE the iFrame!!!!

      That's my problem!

      Thanx anyway!

      Comment


      • #4
        whoa, settle down!!!

        Explain exactly what you want to do then...

        ~Quack

        Comment


        • #5
          Brief:
          Code:
          <script type="text/javascript">
          function zPrint(oTgt)
          {
          	oTgt.focus();
          	oTgt.print();
          }
          </script>
          
          .
          .
          .
          <body>
          	<iframe name="myFrame" id="myFrame" width="600" height="400" src="about:mozilla></iframe>
          	<input type="button" value="Print IFRAME" onclick="zPrint(myFrame);" />
          </body>
          Zvona
          First Aid for
          Web Design

          Comment


          • #6
            I exactly wanted to do what ZVONA did offer me!!!!
            Thanx man

            Comment


            • #7
              What if I only want my frame to be printed if I press ctrl+p or if I choose print in the menu, how can I do that?

              Comment


              • #8
                Originally posted by Zvona View Post
                Brief:
                Code:
                <script type="text/javascript">
                function zPrint(oTgt)
                {
                	oTgt.focus();
                	oTgt.print();
                }
                </script>
                
                .
                .
                .
                <body>
                	<iframe name="myFrame" id="myFrame" width="600" height="400" src="about:mozilla></iframe>
                	<input type="button" value="Print IFRAME" onclick="zPrint(myFrame);" />
                </body>


                How could you fix same csolution using this code? for me it doesn´t work
                I wanna print pictures iframe from the header iframe
                <div id="wrapper">
                <div id="header">
                <iframe id="header" src="header.html" ></iframe>

                </div>
                <div id="content">
                <iframe id="pictures" src="arm001.html" Scrolling="no"> </iframe>

                </div>
                <div id="footer"><iframe id="footer" src="footer.html" > </iframe></div>
                </div>
                </body>
                check the look here:
                http://www.pixelperu.net/iframe/iframe.jpg

                Comment


                • #9
                  I have used above to print a pdf document in an iframe successfully on firefox, but it doesn't seem to work on IE8. The print dialog comes up, but nothing prints.

                  Anybody else experienced this, or know how to make it work.

                  Comment


                  • #10
                    Zvona - thanks for the hack!! It is one of the very few I ever found on a coder blog that I just dropped in and it worked

                    Comment

                    Working...
                    X