How to add a submit button that does an HTTP Post - itext

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.

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.

Why is the raw url of pdf file in github can't be open with browser directly instead of download

I tried pdf, txt and png file url, only pdf url can't be open with browser if click the url, but trigger download.
I google this but only got how to fix, like instead with google doc or use pdf.js, or other html code.
What is the reason? the website ? Forgive me that i have no idea of website architecture.
When you get a file from a website, it has a content type sent along with it. Depending on the content type, the browser may choose to display it. For example, content type "application/pdf" might be shown in a browser, but "application/octet-stream" will be downloaded.
The raw URL on GitHub has content type "application/octet-stream" (a binary file) so that it will be downloaded.
The only way around this, since you can't change GitHub's code that sets the content type, is to get the data from JavaScript and parse it there -- by using pdf.js or something similar.

Web Api capture request data from Adobe Acrobat form submit

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.

Jeditable displays entire HTML document as replacement for the editable field after trigger/submit

I am using jeditable and had it working very weird.
after editing the editable field and submits it instead of printing the new content it displays the entire document window in the textbox(placeholder of editable content).
question: from the example where the author used save.php. what was the content of save.php?
is it necessary to send the result on a php file?? can't an HTML file work?
I believe within the comments box at the bottom of the author's main page - somebody has kindly provided a version of the save.php file for people to use and modify as needed.
The save.php file is used to actually save the values of the editable field/s. Without it, nothing would happen to the data and it would reset to the default text if the page is refreshed.
Options instead of a php file could be:
Saving the text/select changes to a Cookie
Using another server side methos such as asp, jsp, rails or .NET to process the saving of the changes.
an html page is a static page with no processing facility per say to communicate with the website server, so no.. html is not suitable for such a need.
Saving script must return the string you want to display on page after editing. You are now returning full html page.
Source of for all demofiles can be found from GitHub.

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.