Is this possible - Print PDF in popup window's IFRAME?

Discussion in 'Javascript' started by nospam@mlu035.freeserve.co.uk, Jul 29, 2005.

  1. Guest

    All

    I am trying to achieve the following:

    Main window page's asp code writes the following line to launch a popup
    window (note the IFRAME has to be in the popup window, it cannot be in
    the current page)

    response.write("<script language='JavaScript'>var tempprintwindow =
    window.open('papertempprint.asp?path=" & filePath & "','');")

    And the code in papertempprint.asp is as follows:

    <%
    Dim location
    location = Request.QueryString("path")
    %>
    <html>
    <head>
    <script language="JavaScript">
    function printme() {
    frame1.location.href = '<%= location %>'; //probably superfluous
    here.
    frame1.focus();
    frame1.onload = new function(){
    setTimeout("window.print();",5000);
    }
    }
    </script>
    </head>

    <body onload="javascript:printme();">
    <IFRAME height="600" width="800" name="frame1" src="<%= location %>"
    visible="false"></IFRAME>
    </body>

    </html>

    Popup redirects its IFRAME to the PDF file then prints via
    window.print().
    I get the windows print prompt fine, but when I print, just one blank
    page comes out of the printer.

    Is what I am trying to achieve possible. I have tried accessing the
    popup IFRAME from the parent window using javascript and cannot access
    it with
    tempprintwindow.frame1.focus(); or
    tempprintwindow.frames["frame1"].focus(); or any similar attempts using
    window and document objects - I have trawled the web and this should
    work according to the solutions I have found.

    Any help would be much appreciated.

    Many thanks

    --

    Rich (change nospam to mlu035 to reply direct)
    , Jul 29, 2005
    #1
    1. Advertising

  2. VK Guest

    > Popup redirects its IFRAME to the PDF file then prints via
    > window.print().
    > I get the windows print prompt fine, but when I print, just one blank
    > page comes out of the printer.


    PDF file is not a part of the page. It has its own menubar on the top
    (if you look) and print button in that menu bar has to be clicked.
    Otherwise you're printing the containing documeny which is indeed
    empty. I don't know if Adobe plugin provides scriptable interface. You
    may look at their site but my first guess would be no.
    VK, Jul 31, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bad_Kid
    Replies:
    3
    Views:
    3,943
    Shawn H. Mesiatowsky
    Apr 7, 2005
  2. keto
    Replies:
    0
    Views:
    923
  3. Raffi
    Replies:
    4
    Views:
    210
    Dr John Stockton
    Aug 12, 2004
  4. Replies:
    0
    Views:
    250
  5. FatBo
    Replies:
    0
    Views:
    470
    FatBo
    Dec 20, 2005
Loading...

Share This Page