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

L

Leslie McGann

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 RegisterStartupScript 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
RegisterStartupScript is the same when the page loads (works) and when
the button is clicked (doesn't work):

int firstPageToDisplay = pageData.StampPDF();
if(0 == firstPageToDisplay)
{
firstPageToDisplay = 1;
}

Page.RegisterStartupScript("ShowPDF", "<script
language=javascript>showPDF('" + pageData.OutFileURL + "' , '" +
firstPageToDisplay.ToString() + "')</script>");

The script code in the aspx file is as follows:

<script language="javascript">
function showPDF(pdfURL, pageno)
{
pdfURL = pdfURL + "#page=" + pageno;
window.parent.frames.item(0).location = 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top