In a PDF, I can set up a button to:
- Submit the FDF data to my RestAPI
- Redirect to a webpage (to tell user 'Thanks') and that works perfectly.
But I need to do this using code... I am using iTextSharp in the following way:
pbis my pushbutton...
sURLis the URL I need the data to go to...
This is my code:
PdfFormField pff = pb.Field; pff.SetAdditionalActions(PdfName.A, PdfAction.CreateSubmitForm(sURL, null, PdfAction.SUBMIT_XFDF)); af.ReplacePushbuttonField("submit", pff);
PdfName.Ubased on examples and I am not certain what the different names are for. Unfortunately, none of them solve my problem.
SetAdditionalActions() replaces the existing actions. I have also tried using annotations and just adding a button that doesn't exist.
You are looking for a concept called chained actions. This is how itâ€™s done in iText 7:
In this case, we have an action that shows an alert, prints a page and redirects to an URL. These actions are chained to each other using the
It is very easy to port this Java code to C# replacing lower case with the upper while using methods.
Click this link if you want to see how to answer this question in iText 5.