Submitting a PDF file and saving in ColdFusion - pdf

I need users to be able to fill out a form in a PDF file using their browser then, when they click the submit button in the PDF file's form, a new PDF file is saved with the contents they entered in the form.
One of the main examples I have been referencing is Adobe's help section on this subject, but have had no luck: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec11c2b-7ffa.html
The PDF file I was provided didn't have a submit action associated with it. So, I opened up LiveCycle designer and found the submit button and added this code to it:
<submit format="pdf" target="http://localhost:8500/pdfforms/pdfreceiver.cfm" textEncoding="UTF-16" xdpContent="pdf datasets xfdf"/>
Changing the target to the correct location on my local server, of course. Then, when I use this portion of code:
<cfpdfform source="#PDF.content#" action="read" result="fields"/>
<cfdump var="#fields#">
I get an error saying:
Element CONTENT is undefined in PDF.
I also tried opening it up in Adobe Acrobat X Pro and setting the action to submit the entire PDF file, but that didn't work either. I'm using ColdFusion 9 on Windows 7 if that helps any. Thanks in advance for your help!

You don't use CFPDFFORM to read the results from submitting a PDF. The PDF form should do a FORM POST to the target page, just like an html web form.
You can see the results of the form by doing a CFDUMP on the FORM scope:
<cfdump var="#form#">
Then you use a variety of methods to parse through and store that information in a database.

Related

Generating PDF in Orbeon

We would like to generate a PDF without using the existing "PDF" button, but we would like to add our own button that gets a custom template and generates a document filled by the data in the form.
Which Orbeon API we can use for this purpose? This API will get the form id and the PDF template and will generate the document.
The API should give us the possibility to :
Map data to the PDF.
Save the PDF in a given directory.
Sdd some changes to the PDF like adding an image and save the document (this will be our custom code).
Download the PDF after process.
What you're looking for sounds very much like Orbeon Forms' PDF template feature. With Form Runner, you can add your own buttons to the form, and those buttons can have their own label and "logic". The latter is defined in a process, which is a sequence of actions. One of those actions is send(), which as its name implies, "sends" some information related to the form to a service you provide.
You can configure that action to send a PDF generated by "filling" a PDF template with the data entered by users in the form by using send(content = "pdf"). You can find more about this in the documentation for the send() action.

Using a GoogleSpreadsheet to fill in a PDF form

I have a very specific question and I would be extremely happy if anybody has any guess on how to solve it. I have: 1.- a PDF form which I have not created myself. 2.- a GoogleSpreadsheet created by myself.
Now the question is: is there any way I can fill in the PDF form using the information in the GoogleSpreadsheet, taking into account that this process should be activated from the GoogleSpreadsheet (since the PDF form is not mine)?
Best regards and thanks so much for everyone's input!
It depends.
You would need edit access to the PDF form, in order to get the field names. With that information, you could create a FDF (Forms Data Format, a PDF-related file format for data, using PDF syntax) file from the Google spreadsheet, which does refer to the PDF form as a base PDF. You then could open that FDF from the spreadsheet, and it should, if your webbrowser supports the Acrobat browser plug-in, grab the base PDF and populate it.
If you can not get the opening from the spreadsheet to work, download the FDF file and open it in Acrobat/Reader, or open the base form in Acrobat/Reader and import the data from the FDF file.

PDF Form data Submission Via REST API / Web Services

I am having a PDF form that saves the data and validate the data entered by user e.g. a client information PDF document that takes client data and when user click on send button, it must post the data to the web service that further process it or saves to database.
I am using Acrobat Professional for this. Can anyone help in this?
Acrobat and Adobe Reader can submit form data to any URL using a button on the document and the "Submit a Form" action or via Acrobat JavaScript (probably unnecessary). You just need something on the server to interpret the data. If you submit as HTML, the submission will look just like query parameters where the key names are the same as the names of the fields and the values, same as the field values without the formatting. To the server, it looks like it was submitted from a standard HTML form so just about anything you have will be able to work with the submission.
You need to use Acrobat Pro to add this button to the document but then Standard and Reader can use it.
See https://helpx.adobe.com/acrobat/using/setting-action-buttons-pdf-forms.html
You can also submit as FDF or XFDF, an XML(ish) expression of FDF, in which case you'll want to use something like the FDF Toolkit to read it but based on your question, I don't think you need to do that.
3rd party edit
Information from the linked page
FDF
Returns the user input without sending back the underlying PDF file.
You can select options to include Field Data, Comments, and
Incremental Changes To The PDF.
XFDF
Returns the user input as an XML file. You can include Comments with
the field data or just the field data.

Customize PDF view inside a browser

I've worked on a requirement that allows me to show a PDF file inside a browser by doingo a Response.ContentType = "application/pdf".
The problem is that the default view of the PDF is always showing the bookmarks menu at the left, is there a way by using HTTP headers or something to tell the PDF viewer not to show the bookmarks section?
Thanks in advance.
There's two ways that you can do it. The way that I would recommend is to actually open the PDF in Adobe Acrobat and go to File, Properties. On the Initial View tab you'll see a lot of options for how to display the PDF. The second way I haven't tested but Adobe says you can pass various querystring options to the PDF. The one you'd probably want is http://example.org/doc.pdf#pagemode=none
The way how a PDF document is displayed can be configured inside the PDF document.
There are a lot of PDF editors that can modify the "viewer preferences" as it is mostly called. One free example is BeCyPDFMetaEdit.

Saving the modified contents of a pdf

I've got a form that I downloaded, I'd like to prefill some content on the form (this is easy using cfpdfform).
Where it gets tricky is I would like to allow the user to modify the contents of that form, and then somehow have those modified contents accessible to me. I didnt build the source PDF so I dont know how to allow the user to "save" the new contents so they can be read.
Any ideas on where I might start on this one?
You can also use the cfpdfform tag to read/write data to a PDF file which has a form. The important thing is that the PDF document already have the form fields available, or that you add them.
I just recently completed a task where I had to have a user fill out a normal web form, and then create a filled version of an existing PDF document. It worked like a breeze!
I think that depending on what you are trying to accomplish, having the user fill out the data in a web form is less confusing than serving up a PDF and expecting them to save that to update a file on a remote server. Just my opinion, though.
http://www.cfquickdocs.com/cf8/?getDoc=cfpdfform#cfpdfform
It's possible for users to complete most PDF forms in Adobe Reader, but when user's try to save the changes they get a popup prompting them that the PDF cannot be saved and would need to upgrade to Adobe Acrobat to have this functionality.
Since Acrobat 7 (or possibly) 8 it's possible to create a form so that it can be completed and saved in reader. In Acrobat open your PDF, and select Advanced -> Enable usage right in reader from the menu. This will prompt you to save the form and then anyone using Adobe reader can complete it.
Once that's done you can open the form in ColdFusion, populate some of the fields and serve it up to the user. Once they fill it in, save it and get it back in ColdFusion you can read the contents using the PDF related tags.
Please note: It's currently not possible to set the "enable usage rights in reader" flag from ColdFusion, you need a copy of Adobe Acrobat or access to Adobe LifeCycle server to do this.
This document may help you:
http://www.adobe.com/education/instruction/teach/coldfusion/CF8-2_advanced_cf8_development_unit8.pdf