Skip navigation
Currently Being Moderated

Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.

Mar 26, 2007 9:38 PM

With Google, I did a very very long search on how to use Adobe LiveCycle Designer to design Interactive/Dynamic Forms, and publish them to the IIS Server and use ASP.NET to populate such forms with field values from back-end Database such as SQL Server.

We are designing and implementing Electronic Forms ASP.NET Application that must detect the user currently logged in to the Windows Intranet (under IIS), and should perform a Look-up to the Back-End Database to extract the User Related Data and Populate the Form Fields to start the Form Processing.

We have the following facts:
1. The forms will be designed using Adobe LiveCycle Designer 7.1.

2. We will NOT use Adobe LiveCycle Forms since it is not on our budget yet.

3. The users will have the required Adobe Acrobat version on the Client PC.

In a typical scenario, the user would go through these steps:

1. The user logs on to the Intranet using his Windows Login ID and Password. Then he starts the APS.NET Application for Forms Processing.

2. He will request a form to fill. The form may be populated with sensitive information such as Salary and only the requesting user must be able to see his Salary on any form.

3. On the server side, the system will use the User Windows ID to perform a query against the Back-End Database and generate the required XML Data.

4. The system must then link/merge the generated XML Data with the requested form and render (post) the form back to the user for further printing and/or submitting via email.

That's it !

I found an add-in product "Adobe LiveCycle® Designer add-in for Microsoft Visual Studio .NET" but it only wraps XPD forms in Visual Studio Component which is not of a great help to my requirements.

If any one could give me any hint on how to implement such requirements.

I truly appreciate any help.

Tarek.
 
Replies 1 2 3 ... 7 Previous Next
  • Currently Being Moderated
    Mar 28, 2007 11:14 AM   in reply to tarekahf
    load submited data from form:<br /><br />  For a = 0 To Request.Form.Count - 1 <br />     If InStr(Request.Form.Keys(a), "Hamta") > 0 Then Hamta = True<br />     If InStr(Request.Form.Keys(a), "Spara") > 0 Then Spara = True<br />     If InStr(Request.Form.Keys(a), "TaBort") > 0 Then TaBort = True<br /><br />     Temp = Request.Form.GetKey(a)<br />     Do While InStr(Temp, ".") > 0<br />         Temp = Mid(Temp, InStr(Temp, ".") + 1)<br />     Loop<br />     Temp = Left(Temp, InStr(Temp, "[") - 1)<br />     If UCase(Temp) = "ARENDENUMMER" Then Ärendenummer = Request.Form(Request.Form.Keys(a)) ' hämta formulärets loginid har hittat loginid<br />     If UCase(Temp) = "NAMN" Then Namn = Request.Form(Request.Form.Keys(a))<br />     If UCase(Temp) = "TEXT" Then Text = Request.Form(Request.Form.Keys(a))<br />  Next<br /><br />Populate the pdf form.<br /><br />  If Hamta = True And RecordAnt > 0 Then<br />     Response.ContentType = "application/vnd.adobe.xdp+xml"<br />     Response.Write("<?xml version=""1.0"" encoding=""UTF-8""?>")<br />     Response.Write("<?xfa generator=""XFA2_0"" APIVersion=""2.2.5028.0""?>")<br />     Response.Write("<xdp:xdp xmlns:xdp=""http://ns.adobe.com/xdp/"">")<br />     Response.Write("<xfa:datasets xmlns:xfa=""http://www.xfa.org/schema/xfa-data/1.0/"">")<br />     Response.Write("<xfa:data>")<br />     Response.Write("<form1>")<br />     Response.Write("<Namn>" & Rs.Fields("Namn").Value() & "</Namn><Text>" & Rs.Fields("Text").Value() & "</Text><Arendenummer>" & Rs.Fields("Arende").Value() & "</Arendenummer>")<br />      Response.Write("</form1>")<br />      Response.Write("</xfa:data>")<br />      Response.Write("</xfa:datasets>")<br />      Response.Write("<pdf href=""http://www.dtp-tjanst.com/Acrobat/PreLoad/PreLoad3.pdf"" xmlns=""http://ns.adobe.com/xdp/pdf/"" />")<br />      Response.Write("</xdp:xdp>")<br />      Response.Flush()<br />      Response.End()<br />  End If<br /><br />I hope that can give some ideas<br />ulf.a@dtp-tjanst.se
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2007 5:42 AM   in reply to tarekahf
    There is no language in the form
    The buttons is submit buttonts with an url.
    You cant submit to a pdf you are always submitting to a aspx.
    ulf.a@dtp-tjanst.se
     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2007 2:33 AM   in reply to tarekahf
    Hello, I need a group with an image jpg and to be able to call and to fill up this group from asp, a greeting
     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2007 8:15 AM   in reply to tarekahf
    Tarek can you explain how you are able to submit a pdf form as a pdf (write as a binary file on the server) via ASP.NET? I do not need to write the form values to a database rather I would like to keep the pdf form as is.

    Thanks
    Mehmet
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2007 12:49 AM   in reply to tarekahf
    Dear Tarek,

    I also need your sample code, as I am also working on adobe livecycle now, but i am haven't any idea about this.

    If you can send me some sample code about LiveCycle form with ASP.NET and SQL Server, it is great appreciated.

    Thanks!
    Stanley
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2007 1:10 AM   in reply to tarekahf
    Try this<br />/Ulf<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()
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2007 4:16 AM   in reply to tarekahf
    Dear Ulf,

    Thanks a lot for your help.

    I have some idea on my work.

    Thanks!

    Best Regards,
    Stanley
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2007 4:21 AM   in reply to tarekahf
    Dear Tarek,

    oh great! Thanks a lot for your code.
    It's really save much time for me.

    Thanks again!

    Best Regards,
    Stanley
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2007 9:19 AM   in reply to tarekahf
    Displaying & Submitting "Interactive PDF Forms".

    1) User browses to page on website.
    2) Page displays an interactive pdf form
    3) User fills out the fields in the form
    4) User click the "submit" button, the interactive pdf form is flattened and saved to a folder on the webserver. Or, the flattened pdf is emailed to other users.

    I can easily create the interactive pdf using Adobe Professional, but how can I display the pdf and capture the "submitted" flattened pdf?
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 11, 2007 2:47 PM   in reply to tarekahf
    Hi Tarek
    I have the same requirement to show data in pdf,. I am able to fill the textboxes, but i am not able to set the values of checkbox and radio buttons.. :(
    i tried by setting the value like 1,'yes','checked','on', but nothing works for me..
    do you have any idea? or anyone else have any idea about that?
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 12, 2007 11:53 AM   in reply to tarekahf
    Thanks Tarek..
    I got it..
    This SECRET tip is great in itself...:)
    I will keep in mind.
    I tried and everything is working now...
    Thanks again Tarek.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2008 10:13 PM   in reply to tarekahf
    test
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2008 10:49 PM   in reply to tarekahf
    Tarek, or anyone for that matter help would be great.

    I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..

    Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.

    My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.

    So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm

    which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.

    My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.

    so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,

    But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.

    I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.

    Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..

    Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.

    or how in the heck can i get this data from the DB into a blank PDF form, like i have described??

    here are some link to reference

    Populating a LiveCycle PDF with PHP and MySQL
    http://www.andrewheiss.com/Tutorials?page=LiveCycle_PDFs_and_MySQL

    HTML form that passed data into a PDF
    http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFForm sUsingHTML/index.html
    and an example
    http://accesspdf.com/html_pdf_form/

    Well some months
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 8, 2008 2:59 PM   in reply to tarekahf
    Tarek:

    Thank you sir. I'm i can gain to my situation with your knowledge, but let me clarify for you.

    This is 100% server side operation, with the entire operation performed in the same directory. In my current testing case this would be the "planner" folder. Please reference my testing files to go along with my explanation

    http://alexisgrand.com/planner/LoanAgreement.pdf

    and

    http://alexisgrand.com/planner/view.php?sort=LastName

    Yes. I am using LiveCycle Designer (8.0)
    =================================================
    NOT a PDF form but rather an HTML form for submission of values to MYSQL DB. **Please note, in my situation this factor is not of importance, we just need a form to get the field values into a MYSQL DB table. But we do want our end result to be a populated PDF served to end-user (Me).

    But I am currently using a short "dummy" form which happens to be a PDF form rather than an HTML form, but this is only because I just happened to have it around, and it is in fact "short" and good for the purpose of me testing, once I get the operation successfully working I will replace with a longer HTML form, and replace all of the parameters accordingly to fit my actual form (which has 68 input fields rather than 5 ;)
    =================================================
    The PDF form to be populated and served to end-user (Me) will be the "un-populated" PDF form that always resides on the server.
    =================================================
    now the client has submitted the form and all value have been inserted into the MYSQL DB table
    =================================================
    I have a repository for all of the form submissions.
    here -- http://alexisgrand.com/planner/view.php?sort=LastName
    each form submission has a corresponding "VIEW PDF" link, which looks something like this

    http://alexisgrand.com/planner/viewpdf.php?id=25

    25 being row id in the MYSQL DB table for this particular form submission, this row contains all of the field values of the submitted , that will be eventually insterted into the blank PDF Form in the directory.
    ==================================================
    http://alexisgrand.com/planner/viewpdf.php?id=25

    notice "viewpdf.php" when this page is activated (by clicking the VIEW PDF link) it requests all of the form values needed, and saves them as variables. after variables are saved viewpdf.php creates the FDF structure, which looks like the following:

    require_once( 'forge_fdf.php' ); <--- remember this***

    $fdf_data_strings= array('form1[0].#subform[0].#area[0].LastName[0]' => $pdf_LastName, 'form1[0].#subform[0].#area[0].FirstName[0]' => $pdf_FirstName, 'form1[0].#subform[0].#area[0].EMail[0]' => $pdf_EMail, 'form1[0].#subform[0].#area[0].IDNum[0]' => $pdf_IDNum, 'form1[0].#subform[0].#area[0].NetID[0]' => $pdf_NetID, 'form1[0].#subform[0].#area[0].DateSubmitted[0]' => $pdf_DateSubmitted);
    $fdf_data_names= array();
    ==================================================
    viewpdf.php then calls on forge_fdf.php which creates an actual "FDF.tmp" on the server (of course in the planner folder)

    the FDF.tmp file if opened in a plain text editor would look like this:

    %FDF-1.2
    %âãÏÓ
    1 0 obj
    <<
    /FDF << /Fields [ << /T (form1[0]) /Kids [ << /T (#subform[0]) /Kids [ << /T (#area[0]) /Kids [ << /T (LastName[0]) /V (Trip) /ClrF 2 /ClrFf 1 >>
    << /T (FirstName[0]) /V (Chris) /ClrF 2 /ClrFf 1 >>
    << /T (EMail[0]) /V (chris@chris.com) /ClrF 2 /ClrFf 1 >>
    << /T (IDNum[0]) /V (777777777) /ClrF 2 /ClrFf 1 >>
    << /T (NetID[0]) /V (555-55-5555) /ClrF 2 /ClrFf 1 >>
    << /T (DateSubmitted[0]) /V (2008-02-01) /ClrF 2 /ClrFf 1 >>
    ] >>
    ] >>
    ] >>
    << /T (id) /V (4) /ClrF 2 /ClrFf 1 >>
    ]
    >>
    >>
    endobj
    trailer
    <<
    /Root 1 0 R

    >>
    %%EOF
    ==================================================
    pdftk.exe is now called upon to stuff the FDF into the blank PDF form, flatten it and serve it up to the end-user -- yes, that would be Me ;)

    DONE!
    ==================================================
    My problem is that this workd GREAT when tested locally http://localhost/planner/ on my Windows machine using WAMP Server

    but remotely (where I need it) I use a shared hosting provider on a Linux server, and cannot use pdftk.exe being that is a Win32 based app. (Windows)

    there are Linux builds of pdftk, but I am restricted from any installations or shell access.
    ===================================================

    so I decided it was that important that i would purchase another hosting plan just to handle this operation, and it would need to be a Windows server to use the pdftk.exe, with the ability to use MYSQL and PHP scripting.

    Ok so i have got that taken care of a hosting provider @ only $5 per month plenty of what with more than what i need.

    BUT i am not able to control READ, WRITE, EXECUTE permisssions from the control panel, only READ & WRITE.

    So after many emails and days, and repeating the sceanrio over and over to tech support, even thought everything is outlined in my Support tickets, and I even made a screen recording demo for tech support.

    They have told me that the folder as full permisssions and pdftk.exe is permissioned to EXECUTE.

    I get nothing! Just to test, i turned the option off, which deletes the FDF.tmp file immedietly (very quickly) after the merging. Now the FDF.tmp files remain on the planner folder.

    They are named like so in this case fdf4AE.tmp, fdf4AF.tmp, fdf4B0.tmp, etc..

    well when i activate the viewpdf.php page to do the merging and serve the file up to end-user , tmp files are ever created?? as I connect and reconnect to the directory via FTP to check, and also view from the File Manager in the hosting Control Panel. No tmp files.

    so thinking they may be hidden, I move a view tmp file created locally onto the server, and they show up wihtout a problem.

    this is were I am stuck at.
    ==============================================

    NOW what i have done as a temporary remedy, and the next best thing, which definately is not what Im looking for, is following, i have done this one my orginal remote Linux server.

    I have to ave me from typing, I ave created the same scenario as above, but eliminated forge_pdf.php and pdftk.exe from the equation, and intstead, an XML file is served up to end user rather than a finalized PDF. the XML file has to be imported into the unpopulated PDF form, via the Import function under manage forms in Acrobat Pro 8.

    you may think this is not big deal, but this isn't close to what I am need of.

    so I believe I covered everything. The funny thing is that I do not formally know PHP, I have just examined code and figured everything out thus far.

    So does your answer vary in this situation? One thing i can say is that on the Windows server I am using I can use ASP.NET for scripting, so I thought you may be able to provide a solution?
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 8, 2008 10:31 PM   in reply to tarekahf
    Thank you, but it definately needs to be an HTML form, as this form is passed to folks all ovver the country to fill out and any one that doesnt have Reader or the correct version.. even though to you and I is just a matter of a couple minutes to resolve but I have seen clients that are not so saavy, just see this as frustrating and move on.

    so the HTML form is the solution for the client, and right now everything to set, that onc e aPlanner is submitted, and email link would go out to myself, (producing a fully filled Planner, and seperate emails sent to different folks in the workflow, but with certain fields ommitted for each recipeitn depenfing on there department and if the criteria is relevant to them.

    if i could just get thed data merged, everything else is in place.. and life would be even better :)
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2008 10:29 AM   in reply to tarekahf
    Hi Tarek

    I just want to say thank you for the article it's been a great deal of help. I have only one question. Do you know of any way I can set the values of no fillible objects? For example. I want to fill in the submit URL of a button or change the text in a text object. Is this possible?
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2008 6:04 AM   in reply to tarekahf
    Hello Terek, thanks for responding. You are understanding my situation perfectly. I have two requiremtns for the button. 1 Change the submit url and 2 Change the visibility. I also want to be able to change the text inside a label. I've been playing around with the iTextSharp library but it doesn't seem to have that capibility. Any examples you might have would be appreaciated.

    Thank You,

    Matt
     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2008 2:13 PM   in reply to tarekahf
    How are you able to retrieve the entire pdf file after you submit to the ASPX page? I am able to retrieve the form fields but I don't see any "chunk" element that contains a pdf.

    On submit, here is my javascript:
    event.target.submitForm( {cURL: "http://localhost/EmployeeHire/TestPDF.aspx?SubmittedFormPart=1",bXDP :true, cSubmitAs:"XDP", aPackets:["datasets", "pdf"]});

    When setting aPackets to dataset & pdf, the submit button does not seem to work/post any data to the aspx page. But works when I set it to "*". However, there is no "chunk" element.

    Any help will be great. Thanks.
     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2008 6:26 AM   in reply to tarekahf
    Tarek,
    I added the javascript as you had provided. Also, I got the latest reader 8.1. Still the same result. I tried to debug the application, the pdf does not post the form. It does when I remove "pdf" from aPackets parameter. Any suggestions?
    Is there anything that I need to for the pdf? I created the form using LiveCycle and saved the file. Is there anything else I need to do with the file? When I change the aPackets to "*", the form gets submited to the page and I can see a Template element but no chunck. Is there anything I am doing wrong?
     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2008 7:53 AM   in reply to tarekahf
    I was going through Adobe Help and came across..

    "Save rights required (): When submitting a
    document as XDP from the Adobe Reader with
    aPackets set to pdf (or *, which implies pdf), the
    document must have document save rights."

    Does this mean all my users must have professional adobe versions? I am trying to put a public webSite. Appreciate your thoughts and suggestions.
     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2008 2:58 PM   in reply to tarekahf
    is it possible to take a form and upload the xml data to a web server? I found a way to create an email with the .xml file and I found a way to save the data from a form as an .xml file using "xfa.host.exportData" but for the life of me I cant figure out how to post or upload the .xml file to a web server. The closest that I think I have to come to a solution is the "event.target.submitForm" code that was posted in this thread but I dont know what kind of .aspx code I need to write. Currently, the users have to fill in the form and save the file as a .xml file and then go to a .html page I wrote and browse to the .xml file and then click another button to upload the file to a sever, which is a .asp page

    first is it possible to do what i want?

    If so, do you have a sample or generic .aspx code you can post here? All i want is to create a button that posts the .xml file to a web server - even FTP will work but I need the whole .xml file.
     
    |
    Mark as:
1 2 3 ... 7 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)