Hi Guys,
I have a website that contains a page that serves up PDFs via embedding with an tag. The reason for embedding is to use the hostContainer object to pass data back & fourth between the web page and PDF doc in some instances. This works quite well.
The PDFs ultimately SUBMIT (via javascript) to an aspx web page - a listener if you will. This page uses the FDFToolkit to open the FDF from the stream (FDFOpenFromBuf), perform some other tasks, and ultimately needs to redirect to another ASPX page. I do not have a need to send any FDF back down to the browser - once the user clicks SUBMIT from within the PDF and the document is processed by my listener page - I simply need to redirect to a new, unrelated page.
The problem is that upon redirect (after closing and cleaning up the FDF and other object(s)), the site hangs. I can see the page name of the intended redirect target page in the address (URL) bar - but the page is either never fully loaded or takes SEVERAL minutes. In some instances the page is loaded quickly but hangs on loading any IMAGES withing the page.
I suspect something is going on with needing to clear the response before attempting to redirect? I have tried EVERYTHING, including using certain combinations of response.end(), response.clear(), etc. etc. etc. Nothing seems to work here. Another strange thing is that if I don't load the PDF into an tag embedding it in the page - the redirect works as expected. In other words - if I do the PDF SUBMIT from the URL of http://test.com/PDF.pdf - the redirect on the listener page WORKS. If I do it from http://test.com/container.aspx?path=PDF.pdf (which successfully loads the PDF in the page by path into an tag on the page container.aspx. So this must also have something to do with having the PDF loaded as an on the "container" page.
Does anybody have any thoughts here? I've been stuck on this one for several days - your input is GREATLY appreciated!
Kyle
The best way to handle all these issues is to break the submit operation down to the lowest common denominator.
1. Acrobat/Reader Always expects an HTTP Response.
2. The simplest, most broadly well handled response is FDF data.
So, always append the submission URL with "#FDF", and return FDF. This doesn't have to be anything really meaningful, you don't need to send back any data. My favorite thing to do is to send back a script that displays a friendly message such as "Your data submission has been recieved." This will neatly tie up things with Acrobat/Reader regardless of the viewer situation. And then you can redirect the browser to a new page.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script