Problem redirecting to specific PDF page in an iframe using ASP.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leslie McGann

    Problem redirecting to specific PDF page in an iframe using ASP.NET

    Hi,

    I need to open a different pdf file in an iframe each time the user
    clicks a button. I also need to open the pdf to a specific page each
    time. The pdfs in question are located on a web site/virtual
    directory on a different server.

    I'm using the RegisterStartup Script function to perform a redirect to
    the new pdf the first time the page is loaded and each time this
    button is clicked. The problem is that the pdf document only comes up
    the first time the page loads, but not any time after that as long as
    I'm using the #page= specifier (I get a blank area where the iframe
    should be). If I remove the #page= specifier, then the new pdf gets
    loaded up every time with no problem.

    I'm mystified as to why the redirect works the first time the page
    loads but not subsequently. I put in an alert() to check the virtual
    path to the pdf each time, and verified that this was correct. Also,
    if I take that path and paste it into a new browser window, the pdf
    comes up just fine with the page specified.

    I'm running IE 6.0 and have Adobe Acrobat 5.0 installed. The call to
    RegisterStartup Script is the same when the page loads (works) and when
    the button is clicked (doesn't work):

    int firstPageToDisp lay = pageData.StampP DF();
    if(0 == firstPageToDisp lay)
    {
    firstPageToDisp lay = 1;
    }

    Page.RegisterSt artupScript("Sh owPDF", "<script
    language=javasc ript>showPDF('" + pageData.OutFil eURL + "' , '" +
    firstPageToDisp lay.ToString() + "')</script>");

    The script code in the aspx file is as follows:

    <script language="javas cript">
    function showPDF(pdfURL, pageno)
    {
    pdfURL = pdfURL + "#page=" + pageno;
    window.parent.f rames.item(0).l ocation = pdfURL;
    }
    </script>

    Could this be an issue with how the browser and the plugin interact
    when a redirect is done on a particular frame during a postback as
    opposed to when loading the page for the first time? Any suggestions
    would be greatly appreciated.

    Thanks,
    Leslie
Working...