I am generating an editable PDF form at the server side and sending it to the browser. At the client side, I am saving the PDF and adding the fields and submitting it via Acrobat Reader. Now once the servlet has read the form fields, I want to send a success response back to the Acrobat Reader letting the user know that the form has been successfully submitted.
How do I send a response back to the Acrobat Reader as a java servlet response?
What do you want the end user to see?
- Usually, I send back simple HTML saying "Thank you for submitting your form." When the form is archived, I add a link to the filled out form so that people can check what they've filled in.
- When I don't want anything to happen, I send a response code "204 No Content" to the browser. In that case, nothing happens. That's not what you want, but maybe you can return "200 OK" or "202 Accepted". The end user won't see much, but the browser will know what happened. More info can be found on the W3C site.
In many cases, it's common to send a mail with either the link mentioned in (1) or the actual filled-out PDF.
Note that option (1) is only valid when you submit the form from a browser, using Adobe Reader / Acrobat as a plug-in. When using Adobe Reader / Acrobat as a standalone application, you'll have to use option (2) or (3), because Adobe Reader / Acrobat can't interpret HTML and will throw an exception saying that it has received content that can't be read.
Click this link if you want to see how to answer this question in iText 5.