Seiten

Dienstag, 15. Mai 2012

Filling out and sending PDF formulars with Adobe Reader

The goal
We need a pdf formular which can be fill out, save as local copy and send it without circumstances directly via E-Mail to a specific adress. The request should be treaten automatically in Sharepoint 2010. The content of the formular was copied to a list and a workflow started for processing the request through the different instances. In addition to the overview the origin filled out pdf formular should be able to open again.

Solution
I created a formular in Adobe LiveCycle Designer ES2 9. It got different text and input fields and they are arranged by tables. Finally i added a button - not an "E-Mail submit button" - and change the control type to "submit". After the value of the "Submit to URL" field was changed to mailto:name@adress.com. The content of the submission was changed to "XML Data Package (XDP)".
Why XDP?
I'm not an IT expert but playing with different function, googling around and having enough time i discovered that an XDP file contains a PDF and the XML structure of the formulare together with the filled out data. For me the strange thing ist that changing the entered data in the xml structure will lead to changes in the PDF! So, when I edit the XDP file with a texteditor and open it again with the Adobe reader, the content has changed.
After sending the filled out formular, it should not be possible anymore to change the content. The following code is executed when clicking the Send Button:

if

(form1.execValidate() )

{

// Get the field containers from each page.


for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++)

{

var oFields = xfa.layout.pageContent(nPageCount, "field");


var nNodesLength = oFields.length;


// Set the field property.


for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++)

{
oFields.item(nNodeCount).access

= "readOnly";

}
}
Button1.presence

= "invisible";

}


When clicking the the send button, the formular validate every entered input. If everyting is correct, every field will be set to "read only". Finally the Send Button will be set as "invisible".
For a detailed explanation see the quotet source or the adobe manual.

Now we have to change some settings of the formular properties. (File -> Form properties -> Defaults). For better support i choose the earliest version of adobe reader up to today. Then the default language is JavaScript and the it has to run default on the clients machine. Additionaly preserving scripting chnges is set to "autmatically" and the option "Enforce Strict Scoping rules in JS" is checked. Finally we need to set the rendering method to static form.

Now we have to save the formular as static PDF form: File -> Save As.

What we got ist es static PDF-Formular which we can open and fill out. Sending the content of the formular already works - but only for users with the Adobe professional version! User of the free Reader Vesion are still not able to sent the filled out form.
Making it possible for free reader users we have to open our new formular in Adobe Acrobat Professional 10 or earlier. Then click on:
Datei -> Speichern Unter -> PDF mit erweiterten Reader Funktionen -> Zusätzliche Funktionen aktivieren -> jetzt speichern.


Finally for Free Reader User it is now possible to sent the entire formulare as XDP via E-Mail back to you and having the possibility to save a local copy.

Keine Kommentare:

Kommentar veröffentlichen