Web Api capture request data from Adobe Acrobat form submit - itext

I have a PDF which has a submit button which will submit the PDF fields as an html form to my web API. The submit part works, however it is sending the request payload in a format I have never seen before
Also the request doesn't show the content-type being sent. I supposed it was being sent as application/octet-stream so I added this custom MediaTypeFormatter I found and it still didn't work.
I am filling the PDF fields using iTextSharp and the sending it to the client. The client creates a BLOB URL to display it in an iframe. I noticed that the problem is due to this, because when opening the PDF by itself and filling the data manually and then submitting it works fine, so the problem has to be either when I fill the form fields or when I create the BLOB URL in the client.

That's an Adobe format called FDF (Forms Data Format) but that's just one option for the submit format. You can also submit the data as the equivalent of an HTML GET using the settings shown in the images below.
If your API can accept data from HTML forms, it should work from Acrobat as well.

Related

Google Apps Script - Submit PDF Form Data (Image)

Is there a Google Apps Script that can retrieve form data from a fillable pdf form and export it to my Google Drive when I click submit form? I don't need the complete document to be exported, it's only a selected field (image-field) that I particularly need to be exported. I am working from Adobe Acrobat Pro. I'm sorry I have no code to show what I have tried so far because I am a novice in this.
Updated:
According to Adobe, submitForm () function is one of the most flexible ways of moving data in and out of a form as it uses GET to send or receive data from a web server. Where the submitForm () has a variety of input arguments for just about any data format from the entire pdf to images.
One forum (on Adobe Library), raised an exact question, and a brief response provided to look into Google Apps Script. I found a similar question on stack overflow - the user wanted a form submission from their Site to GDrive Spreadsheet using GAS. Whereas I have a standalone PDF form, and on form submission, I need the (image) data from the pdf form exported to my GDrive Folder.

How to add a submit button that does an HTTP Post

How do I code the "CreateSubmitForm" command so that it generates a button that will submit an edited PDF back as HTTP POST?
First things first: submitting an edited PDF is only possible if the end user has Adobe Acrobat or if the PDF is Reader-enabled. In all other cases, you can only post the data (as a query string, as an FDF file, or as an XFDF file), you can not post the complete PDF from Adobe Reader.
By default, the submit button will be sent to the server as a HTTP POST. If you want HTTP GET, you need to set a flag. In other words: just create the button and you'll have an HTTP POST.
Important: the POST is performed from the PDF viewer, so it is very important to understand that you can not put any HTML in your Response. The PDF viewer will show an exception if you do. The PDF viewer expects either nothing (status code 204: No Content) or a stream of PDF (or correctly formatted FDF). All other content types will be rejected.
Note: although the question is tagged as an iTextSharp question, this answer is not limited to iTextSharp. It's just the way things are with PDF and Adobe Reader.

acrobat pdf submit button for forms - fields order in xfdf

My solution:
User opens PDF file on web server in browser.
User is entering form fields and pushing submit button.
Submit button sends XFDF data through POST to my PHP script.
When I get POST data, form fields are in random order.
I'm creating XFDF document based on POST and then process it further. Preferably fields should be in the same order as in PDF file.
Question:
I don't know how to control adobe reader to send form data in some predictable order. Form fields numbering (controlling flow of document when using TAB) is not changing resulting POST data order.
Any ideas how to order fields?

Why are Google Analytics Values being passed on a form submit?

My company's app builds simple forms that people can use on their websites to get information into our app. We have a generic form response script that each of these forms submits to, to gather and parse the webform responses.
We're encountering form values that look a lot like the values in Google Analytics cookies (utmz, utmsc, utmccn) The cookies are clearly not part of the form fields. The form is being done with a simple HTML form submit, so I'm at a loss how these values are getting appended on to the post.
Here's a sample form submission:
http://website.com/submit.php?&clientGuid=2342342abcde23423423&webformid=12&prospect_id=12345&custom_Register_or_Dance_the_Chicken=Register&__utma=84164169.205192989.1344888984.1346176569.1346178936.47&__utmc=84164169&__utmz=84164169.1344888984.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Under what circumstances would a browser submit cookies along with a form submit? Is there a way to prevent it?
This looks like cross-domain user tracking... From the Google Analytics docs for _linkByPost():
The _linkByPost() method passes the GATC cookies from the referring form to another site in a string appended to the action value of the form (HTTP POST).
If there's no onsubmit='...' code directly on the form, it might be attached via jQuery or some other method.
It may be due to Google Chrome adding them to your form variables on submission...

Create a fillable PDF that POST's it's data then returns a flattened PDF with the data in it the user can save

I have a pdf that currently people fill in, print out, hand to a receptionist who scans the paper form into a pdf, enters the form fields into a web form, attaches the scan to the web form and submits that. This is dumb.
What I want is a PDF form that once filled out the user can press a submit button. That submit button sends a post request to a web server with the form fields and the completed form. So far I can do half of that, submit the fields to a web site where they show up in POST, and the server's response gets returned to the user as a PDF, at least in Acrobat pro it does. Reader throws an error, but I am hoping that if the server returns a PDF reader will open it.
What I need is the submit button to send the fields to the server, along with a copy of the completed form. I can catch it with PHP and do everything I need from there. Preferably I would like both in the same transaction, but if not I can work around it.