Expand my Community achievements bar.

How to populate Adobe LiveCycle Designer generated PDF Forms with data from Database in Windows app

Avatar

Former Community Member
Hi



I have a PDF template designed in Adobe LiveCycle Designer. This template has form fields which needs to be filled with data programmatically. I am using windows application in C#.Net 2005 in which I want to retrieve data from database and merge this data into PDF form in respective fields.



How this can be achieved?



I searched a lot & I found that we can process the XDP file generated from PDF to acheive this. I created the XDP file out of the PDF template created in designer. But I don't know how to merge data from database into that XDP file in respective fields and again convert this XDP file back to PDF programmatically. Can anybody help me ? This is urgent.



Thanks in advance.



Sambhaji
11 Replies

Avatar

Former Community Member
It's documented in IACReference.pdf

ulf.a@dtp-tjanst.se

Avatar

Former Community Member
Hi Sambhaji

My task is to convert XDP file into pdf file programmatically (.NET).

Can you please help me out.



Thanks

Amitesh Singh

www.amitesh.info

Avatar

Former Community Member
asp.net<br />Regards<br />ulf.a@dtp-tjanst.se<br /><br /> Response.ContentType = "application/vnd.adobe.xdp+xml" <br /> responseString.Append("<?xml version='1.0' encoding='UTF-8'?>") <br /><br /> responseString.Append("<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>") <br /> responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>") <br /> responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>") <br /> responseString.Append("<xfa:data>") <br /><br /> responseString.Append("<form1>") <br /> responseString.Append("<txtFirstName>Homer</txtFirstName>") <br /> responseString.Append("<txtLastName>Simpson</txtLastName>") <br /> responseString.Append("</form1>") <br /><br /> responseString.Append("</xfa:data>") <br /> responseString.Append("</xfa:datasets>") <br /> responseString.Append("<pdf href='http://localhost/PDFFiller/TestForm.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />") <br /> responseString.Append("</xdp:xdp>") <br /><br /> Response.Write(responseString) <br /> Response.Flush() <br /> Response.End()

Avatar

Former Community Member
Hi <br />Thanks for your help.<br />I tried the above code but its not wroking.<br /><br /><mycode><br /><br />Response.ContentType = "application/vnd.adobe.xdp+xml";<br /> StringBuilder responseString = new StringBuilder();<br /> responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br /> responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br /> responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br /> responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br /> responseString.Append("<xfa:data>");<br /><br /> responseString.Append("<form1>");<br /> responseString.Append("<txtFirstName>Homer</txtFirstName>");<br /> responseString.Append("<txtLastName>Simpson</txtLastName>");<br /> responseString.Append("</form1>");<br /><br /> responseString.Append("</xfa:data>");<br /> responseString.Append("</xfa:datasets>");<br /> responseString.Append("<pdf href='http://localhost/PDFFiller/TestForm.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br /> responseString.Append("</xdp:xdp>");<br /><br /> Response.Write(responseString);<br /> Response.Flush();<br /> Response.End();<br /><br /></mycode><br /><br />What am i doing wrong here ?<br /><br />Thanks <br />Amitesh

Avatar

Former Community Member
the part <form1> to <form1/><br />must be adapted to your form<br />the part pdf href='http://localhost/PDFFiller/TestForm.pdf' <br />must be adapted to your server and your pdf.<br />Regards<br />ulf.a@dtp-tjanst.se

Avatar

Former Community Member
Yeah, It worked. :)<br /> One more question : how dropdowns can be populated dynamically in PDF forms designed in LiveCycle ?<br /><br />I have added a dropDownList into the form and i Want to add items to the dropdown list dynamically.<br /><br /><mycode><br /><br />Response.ContentType = "application/vnd.adobe.xdp+xml";<br /> StringBuilder responseString = new StringBuilder();<br /> responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br /> responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br /> responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br /> responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br /> responseString.Append("<xfa:data>");<br /><br /> responseString.Append("<form1>");<br /> responseString.Append("<TextField1>Homer</TextField1>");<br /> responseString.Append("<TextField2>Simpson</TextField2>");<br /> responseString.Append("<field name ='DropDownList1'>");<br /> responseString.Append("<items save='1'><text>1</text><text>2</text><text>3</text></items></field>");<br /><br /> responseString.Append("</form1>");<br /><br /> responseString.Append("</xfa:data>");<br /> responseString.Append("</xfa:datasets>");<br /> responseString.Append("<pdf href='C:\\Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br /> responseString.Append("</xdp:xdp>");<br /><br /> Response.Write(responseString);<br /> Response.Flush();<br /> Response.End();<br /></mycode><br /><br />why is n't working ?<br /><br />Thanks for ur help.<br />Amitesh Singh<br />www.amitesh.info

Avatar

Former Community Member
Please ignore the above code.<br />The following one is correct one.<br />using System;<br />using System.Data;<br />using System.Configuration;<br />using System.Web;<br />using System.Web.Security;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br />using System.Web.UI.WebControls.WebParts;<br />using System.Web.UI.HtmlControls;<br />using System.Text;<br />public partial class _Default : System.Web.UI.Page <br />{<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /> Response.ContentType = "application/vnd.adobe.xdp+xml";<br /> StringBuilder responseString = new StringBuilder();<br /> responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br /> responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br /> responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br /> responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br /> responseString.Append("<xfa:data>");<br /><br /> responseString.Append("<form1>");<br /> responseString.Append("<TextField1>Homer</TextField1>");<br /> responseString.Append("<TextField2>Simpson</TextField2>");<br /> responseString.Append("<field name ='DropDownList1'>");<br /> responseString.Append("<items save='1'>");<br /> responseString.Append("<text>1</text>");<br /> responseString.Append("<text>2</text>");<br /> responseString.Append("<text>3</text>");<br /> responseString.Append("</items>");<br /> responseString.Append("</field>");<br /><br /> responseString.Append("</form1>");<br /><br /> responseString.Append("</xfa:data>");<br /> responseString.Append("</xfa:datasets>");<br /> responseString.Append("<pdf href='C:\\Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br /> responseString.Append("</xdp:xdp>");<br /><br /> Response.Write(responseString);<br /> Response.Flush();<br /> Response.End();<br /> }<br />}

Avatar

Former Community Member
The best is to create a webbservice that deliver the data on load.

ulf.a@dtp-tjanst.se

Avatar

Former Community Member
Thanks again

I have another question regarding WebService.

How to bind data (Response) in the webservice. ?



I know to do it using Object window ( binding -> import/export bindings (Execute) )

How to access xml node explicitily.

Can I get the return value by Web Service through program ?



xfa.connectionSet.DataConnection.execute(0);



var x=xfa. datasets.connectionData.DataConnection.Body.HelloWorldResponse.HelloWorldResult.HelloWorldResponse;







The above line of code is not working ! :-P



Error :



xfa.datasets.connectionData has no properties !











my Web method is



[WebMethod]



public string HelloWorld() {



return "Hello World";



}







Thanks



Amitesh Singh

Avatar

Former Community Member
Bind the responce to a textbox

ulf.a@dtp-tjanst.se

Avatar

Former Community Member
Hello,



i tried this on my own, i created a simple webservice and a data connection in livecycle designer 7.



when i try to execute the ws request, i get an error message "daten konnten nicht in '' übertragen werden", something like "data could not be transmitted to ''" in english...



thanks a lot in advance



Michael Weinheimer