tags:

views:

758

answers:

5

I was wondering if there is any way to notify a user in adobe reader that a pdf form has been submitted to the server? I am submitting a normal http/html form to a php script no big deal, straight forward, but there seems to be a big "black hole" in documentation, forums etc. as to what happens when the form is submitted.

Isn't there a way to trigger a javascript alert after I have submitted a form?? I dont't want to return another pdf that says "thank you", that is a bit tacky. I am very new to pdf forms so I am guessing there must be a way to return FDF to the original document that has some javascript in it that is executed eg alert('thank you for your feedback!')..

This should really be straight forward, I assumed Adobes much hyped PDF technology was much more developer freindly and accessible..

Any ideas?? (Oh and please don't ask why I am using pdf forms and not the web, this is coming from "The Top", so as a developer I just have to do it..)

A: 

I managed to happen upon the answer after 3 days of searching, adding a header for fdf file in the php script, adding '#FDF' to the end of the url in acrobat seems to have been the solution;

%FDF-1.2 1 0 obj << /FDF << /JavaScript << /Doc 2 0 R /After (confirmSend();)

> > > endobj 2 0 obj [ (confirmSend) 3 0 R ] endobj 3 0 obj << > stream function confirmSend() { app.alert("The form has been successfully submitted\nThank you for your feedback!", 3); } endstream endobj trailer << /Root 1 0 R > %%EOF

A: 

banarep,

I'm looking at your question about giving the user feedback after they submit a PDF form.

THis is just what I need to know how to do.

But I can't understand your answer.

Can you clarify it?

thanks,

Terry

tkilshaw
A: 

The server script which you are posting to must reply with this content type in the HTTP header:

'Content-Type: application/vnd.fdf'

eg. If you are using PHP:

header('Content-Type: application/vnd.fdf')

followed by the relevant bastardized-pdf-javascript-mutant-half-bread that will trigger the alert() dialog.

%FDF-1.2
1 0 obj
<<
/FDF
    <<
    /JavaScript 
        << 
        /Doc 2 0 R
        /After (confirmSend();)
        >>
    >>
>>
endobj
2 0 obj
[ 
(confirmSend) 3 0 R
]
endobj
3 0 obj
<<
>>
stream
function confirmSend()
{
app.alert({
    cTitle : 'title of the window',
    cMsg : 'message',
    nIcon : 3 
});
}
endstream
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF

I hope you receive this message, as I wasted nearly 2 weeks of my life finding a solution...

bananarepub
A: 

Thanks for this! I too have been searching for a solution to this for hours! It was extremely frustrating. It seems like overkill to install the FDF Toolkit just to get a simple confirmation dialog box after the PDF has been submitted.

I eventually came up with the following through trial and error (it seems there is absolutely no documentation about this on the net):

%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF
    <<
    /Status(Thank you. Your details have been submitted and someone will get in touch with regarding your application.)
    >>
>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

The above will present (or should present) a dialog box in Adobe Reader without showing the "Warning: JavaScript Window" warning.

Hope this ends up being useful to someone.

Julian
A: 

This seems to be "broken" with the latest version of Adobe Reader (9.3). Instead of showing a confirmation message, there's now a security warning that appears after the form has been submitted. Is there any way around this?

jma