Submit form to ASP.NET Web API

Submit form to ASP.NET Web API

Forum member · Jun 6, 2019
Using the SubmitAction I am able to add HTML form elements and submit from a PDF to a WEB API service. However, the form data does not appear. Is there a way to do this? I also tried the JavaScriptAction class, but the PDF documentation states that the submitForm method can only be done when viewing through a browser. I couldn't get it to work either, in any case.

Re: Submit form to ASP.NET Web API

Forum member · Jun 6, 2019
To provide a little more context, I am also not able to get the form fields when posting to an ASP.NET web form. Here's my code: MergeDocument document = new MergeDocument(MapPath("PurchaseOrderReport.pdf")); Label sigLabel = new Label("Enter Initials and Click Approve", 50, 0, 180, 20) { Font = Font.Helvetica, FontSize = 9 }; TextField iniField = new TextField("InitialText", 50, 25, 150, 20) { BorderStyle = BorderStyle.Solid }; Button submitButton = new Button("submitButton", 50, 50, 70, 25) { Label = "Approve" }; TextField resLabel = new TextField("result", 120, 50, 100, 25) { Font = Font.Helvetica, FontSize = 9 }; SubmitAction action = new SubmitAction("http://localhost:63475/Approve.aspx", FormExportFormat.HtmlPost); submitButton.Action = action; AnchorGroup anchorGroup = new AnchorGroup(200, 80, Align.Center, VAlign.Bottom); anchorGroup.Add(sigLabel); anchorGroup.Add(iniField); anchorGroup.Add(submitButton); anchorGroup.Add(resLabel); Page page = document.Pages[document.Pages.Count - 1]; page.Elements.Add(anchorGroup); document.DrawToWeb("SubmitTest.pdf");

Re: Submit form to ASP.NET Web API

Support · Jun 6, 2019
Hi, That should work if you have the right debug port number. Are you getting any errors? Thanks, ceTe Software Support Team

Re: Submit form to ASP.NET Web API

Forum member · Jun 6, 2019
There are no errors. I can debug the Aspx page and it does receive the message. But, the form field is not there. There are no form girls at all

Re: Submit form to ASP.NET Web API

Support · Jun 7, 2019
Hi, Are you using Chrome as the browser by any chance? We've done some testing and it looks like there is an issue with submitting the form using Chrome and it's built in PDF viewer. If you download the PDF and view it with Acrobat or use IE with the Acrobat plug-in, everything works as expected. We'll test some other scenarios as well and see if we can provide more information over the next couple of days. Thanks, ceTe Software Support Team

Re: Submit form to ASP.NET Web API

Forum member · Jun 13, 2019
I was, in fact, using Chrome. I did some testing and found that the submission only works in IE. Edge did nothing and Acrobat Ready throws an error. I suspect this is really security related. As I cannot control how users might open the PDF, I'll have to abandon this strategy. If you are able to get past this problem, I'd love to hear about it as the functionality has a lot of promise.