Sending 'success' response back to Acrobat

2019-08-04 17:18发布

问题:

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 wan 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?

Thanks for any help.

回答1:

What do you want the end user to see?

Some options:

  1. 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.
  2. You could return the filled out form in PDF, but add some document-level JavaScript that opens an alert that says "This form was submitted on 2014-07-21". If you don't like the JavaScript (it can be annoying to see such an alert), why not stamp that message on the filled out form.
  3. 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 here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

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.



标签: java itext