cancel
Showing results for 
Search instead for 
Did you mean: 

Offline scenario - post data from saved form to SQLServer

Former Member
0 Kudos

This is the scenario am struggling to develop. User downloads the interactive form. Goes offline. I mean no connection to the Web Application Server. But he will have access to a SQLServer database (it may be on his machine or in his intranet). He will fill the form and save it on his local hard disk. Now, I want his saved form data to be posted to the SQLServer. I thought about a couple of ways to do this.

1) Is it possible to change the control type of 'Submit' button to submit and then in the URL field, call some ASP page (this page is deployed on a local IIS) and then submit the form fields to that ASP page which takes care of database connection, posting etc. So user downloads form only once. But fills it with different data each time and clicks submit. First of all, will submit button work when the form is not opened in web browser? I mean when it is saved on a local hard disk opened in a standalone Adobe Reader?

2) Is it possible to write some java program using any APIs and extract the data from the form saved on local hard disk? It may be possible because I have the .xdp file for the form. But I dont know if there are some APIs available to do the same.

Any inputs whether these ideas are feasible? Any other new ideas are also welcome. Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Narayana,

xfa.host.exportData("",0) doesn't work for you because your adobe form doesn't have reader usage rights. xfa.host.exportData("",0) has the same functionality as the menu Export data from Forms. For this functionality in Adobe Reader, reader usage rights must be applied to your form. Adobe Acrobat needn't it. For setting of reader usage rights there is the product Adobe LiveCycle Reader Extensions ( http://www.adobe.com/products/server/readerextensions/ ) which is integrated into ADS.

When I wrote "Yes, you can save form in Adobe Live cycle designer as pdf and you can open it in Adobe Reader and test it. It will work." I wrote about the submit button.

Michal

Former Member
0 Kudos

Hi Narayana,

if you want to export xml data from Reader to local disk you can use a command:

xfa.host.exportData("",0);

It works like from menu Export data from Forms.

To your second post:

Yes, you can save form in Adobe Live cycle designer as pdf and you can open it in Adobe Reader and test it. It will work.

In tab Submit for your button set these properties:

Submit Format: XML Data (XML)

Submit to URL: url of your page

Encoding: UTF8

Here is a sample code in c# for asp.net. Insert method save to your asp.net page and call it from method Page_Load.

using System;

using System.IO;

using System.Web;

		private void save()
		{
			const int coniBufferLen=1024;
			string lsTmpFile;
			try
			{
				lsTmpFile="c:\adobe\body.pdf.xml.txt";  // File on local disk where to save xml data sent by Reader. IIS needs rights to write here.
				FileStream loFS=null;
				try {loFS=File.Create(lsTmpFile);}
				catch (Exception e1)
				{
					// TODO
					return;
				} 
				int liCelkem=Request.ContentLength;
				int liNacteno=0;
				byte[] laResponse=null;
				int liLen=Math.Min(coniBufferLen,liCelkem-liNacteno);
				while (liLen>0) 
				{
					try 
					{
						laResponse=Request.BinaryRead(liLen);
						loFS.Write(laResponse,0,liLen);
					} 
					catch (Exception e1)
					{
						try {loFS.Close();} 
						catch {}
						try {File.Delete(lsTmpFile);} 
						catch {}
						// TODO
						return;
					}
					liNacteno+=liLen;
					liLen=Math.Min(coniBufferLen,liCelkem-liNacteno);
				}
				loFS.Close();
			}
			catch (Exception e2)
			{
				// TODO
				return;
			}
		}

Michal

Former Member
0 Kudos

I tried xfa.host.exportData("",0)

but it didnt work. I dont understand why. First of all, when I open the form, I get message in the top saying "You cannot save data typed into this form...". So do I need to change some security setting in LiveCycle Designer somewhere? Where do I change security settings for a form in Designer?

Former Member
0 Kudos

Hi Narayana,

2) Also there is Adobe XPAAJ ( http://www.adobe.com/devnet/livecycle/downloads/xpaaj.html ). But you need to own a license of a server based LiveCycle product, Flex, or Cold Fusion to use XPAAJ.

Michal

Former Member
0 Kudos

Thanks for your immediate replies, Michal. Can you please also answer the queries from my second post?

Or else is there any way, I can write a functionality in Submit button (from standard library) where the form data gets exported to XML (just like the Adobe Reader menu functionality "Document --> Forms --> Export data from Forms...")

Former Member
0 Kudos

Hi Narayana,

1) Yes, submit button work when the form is not opened in web browser. Use control Button from the group Standard. Change his property Control Type to Submit and fill new tab Submit.

2) I think that this isn't possible. For this usage is server side product LiveCycle Forms which is integrated for example into ADS.

But you can try Folder Level JavaScripts, page 42 in http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf

Michal

Former Member
0 Kudos

"Yes, submit button work when the form is not opened in web browser". You mean it works or doesn't? Also, because this is an offline scenario, do I need to deploy application and run it from the server to verify this submit button functionality? Cant I just save it in Adobe Live cycle designer and open it in Adobe Reader and test it?