Submit and Save PDF Forms to Custom Destinations

PDFViewController provides a PDFFormSubmissionDelegate, which can be used to receive information about an ongoing form submission. This allows for the customization of the submit action and also gives feedback on the ongoing HTTP request.

When a form submission action is run, the delegate will receive the following callbacks in order:

  1. formSubmissionControllerShouldPresentResponseinWebView(_:): — Should the view controller push a web view with the response data? If yes, then the web view takes responsibility for the connection and the delegates from point 4 below won’t be called.

  2. formSubmissionController(_:shouldSubmitFormRequest:): — If no, then the operation is canceled.

  3. formSubmissionController(_:willSubmitFormValues:): — The submission is going ahead.

  4. Depending on whether or not the submission is successful, one of the following will be called:

    • formSubmissionController(_:didReceiveResponseData:): — The submission has completed successfully.

    • formSubmissionController(_:didFailWithError:): — The submission has failed.