Skip navigation
Currently Being Moderated

Populate PDF form with XML data

Apr 12, 2005 11:07 AM

Although a seemingly simple task, this question has occupied way too much of my time the last week and I am asking the following out of sheer desperation and frustration.

I have a pdf form created with Designer 7.0. I have a separate XML data file to populate the form with. I can test using the preview in Designer and everything looks great. Now, all I want to do is deploy this pdf to a standard web server (IIS, Windows) such that any visitor to the site (using Reader) is able to open it/view it/print it, with the data there. That's it.

This was easily accomplished using Acrobat 6 by creating an ASP page that output an FDF file which referenced the PDF. Not so with the latest version.

I have downloaded three separate several hundred page documents that do not explain how to accomplish this task simply. So to summarize:

1. Does this task *require* a separate piece of software (Document Server) that was not required before?
2. If Document Server is not required, what are the steps to publish the pdf file and reference the data file?

Please help, extraordinarily frustrated :-(.
 
Replies
  • Currently Being Moderated
    Apr 12, 2005 12:49 PM   in reply to (Garth_Howard)
    Hey Garth,<br /><br />I too struggled with that for over a day and finally got it to work.  Do this:<br /><br />1. Create your form in Adobe Designer.  Save the pdf form and Close.<br />2. Open Adobe and put data in each field you created.  Then click on File, Form Data, Export Data from Form and save to an XML form.  Close the pdf.<br />3. Go back to Adobe Designer and open the pdf.  If your Data View windows isn't showing... Click on Window, Data View.<br />4. Right click on the Data View pane and click on New Data Connection.  You can use the default connection name.  Choose the Sample XML Data radio button and then Next.  Locate the file that you exported in step 2.  Then Click Finish.  All your field names should be in the Data View.<br />5. On each of your fields, click on the binding tab.  Then click on the arrow beside the Default Binding... navigate to DataConnection... and go through your subform(s) to find the field name you want to bind to.<br />6. Save the pdf.  <br />7. Now to ASP:<br /><br />Here is a sample subroutine using a test.pdf with two text fields.<br /><br />Sub writeBody<br />Response.ContentType = "application/vnd.adobe.xdp+xml" %><?xml version="1.0" encoding="UTF-8"?> <br /><?xfa generator="AdobeDesigner_V7.0" APIVersion="2.2.4333.0"?> <br /><xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/"> <br /><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <br /><xfa:data xfa:dataNode="dataGroup"><br /><form1><br /><subform1><br /><TextField1>Test 1</TextField1><br /><TextField2>Test 2</TextField2><br /></subform1><br /></form1><br /></xfa:data> <br /></xfa:datasets> <br /><pdf href="http://www.somewhere.com/test.pdf" xmlns="http://ns.adobe.com/xdp/pdf/" /> <br /><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve" > <br /><annots/> <br /></xfdf> <br /></xdp:xdp><br /><%<br />End Sub<br /><br />I hope this helps.  FDF was A LOT easier but I'm having to convert my FDF logic to XML to keep up with the 7.0 Reader.  I finally figured out how to take the posted data and convert it back to XML so it can be saved and reloaded back into the form if needed.  Let me know if you want some sample code.<br /><br />Good Luck!<br />Floyd
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2005 4:36 PM   in reply to (Garth_Howard)
    Hey Garth.  The orignal data XML that I used was just dummy data so the designer would put the proper data tags in the pdf.  My ASP saves the data from the post operation in a new XML file. Your import should work but make sure it is structured exactly like the export XML.  It should start with something like ..... or it won't map to the proper fields.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 21, 2005 1:25 PM   in reply to (Garth_Howard)
    Need a consultant/programmer that is familiar with dynamic pdf forms. We need to be able to have a pdf form client side and as data is entered, other form data is looked up from a sql database on a webserver and automatically filled in - for example if you fill in your zip code, it looks up your city and state - if you fill in your student id, it looks up your name, address phone, etc - if you fill in your degree program, it looks up the total hours and tuition - you get the idea??

    Once you're done filling out the form there is also new data that will be stored in the database. It is my understanding that this can be done with LiveCycle, Java, XML, ColdFusion, SQL???

    Please email me if you have any input or you can contribute as a consultant or programmer, we're willing to pay the right person or people.

    Thanks!!
    Cynthia
    chebultz@tstar.net
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2005 9:21 AM   in reply to (Garth_Howard)
    Well I cant seem to get past some problem<br />The asp page brings up the pdf file  but the data does not seem to load <br />any one have any ideas <br />here is my asp <br /><br /><%Response.ContentType = "application/vnd.adobe.xdp+xml" %><br /><%response.write "<?xml version='1.0' encoding='UTF-8'?>" %><br /><%response.write  "<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?> " %><br /><xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/"> <br /><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <br /><xfa:data> <br /><form1><TextField1>test a</TextField1></form1><br /></xfa:data> <br /></xfa:datasets> <br /><pdf href="http://myurl.com/xfdf_test.pdf" xmlns="http://ns.adobe.com/xdp/pdf/" /> <br /><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve" > <br /><annots/> <br /></xfdf> <br /></xdp:xdp><br /><%response.flush%><%response.end%><br /><br />and the pdf is just a simple text box ..
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2005 9:34 AM   in reply to (Garth_Howard)
    You need to do a Response.Write() for the XML part as well.
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2005 9:55 AM   in reply to (Garth_Howard)
    No good on that,
    It's almost like the xpath to the data is not right
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 26, 2005 11:05 AM   in reply to (Garth_Howard)
    Garth do you have a sample file of this. i would like to see it in action. Thanks george@skyemark.com
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2005 8:15 AM   in reply to (Garth_Howard)
    Is there a way using this technique to put items (more than one) in dropdown lists ?
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2005 9:11 AM   in reply to (Garth_Howard)
    well yes it works for one item, the value I put in the xml part that correspond to my dropdown list appears in the form, but I am looking for a way to put more than one value. Is there a sub tag name?
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 15, 2005 1:00 AM   in reply to (Garth_Howard)
    Hi there!

    I have nearly the same problem like you...

    I want to populate a pdf form (created with designer 7)with XML by PHP and open it at client side to print or add other values.

    Any idea to do this with PHP instead of ASP ?

    Would help me very much...

    ciao
    Oliver
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 16, 2005 11:20 AM   in reply to (Garth_Howard)
    I have attempted to follow the instructions provided by Floyd and Garth, but all I can manage to do is crash Acrobat Reader 7.0.3 when attempting to view the ASP page. Here are the steps I have followed:

    Create a new form in Adobe LiveCycle Designer 7.0.041126.0 (trial version).
    Add a text box to the form named TextField1.
    Create a simple XML data file; it has one element named "data" which contains one element named "TextField1" which contains the text "sample data".
    Use File - New Data Connection to load the sample XML data file.
    Use the Binding tab for the text field properties to bind the text field to $record.TextField1.
    Save the form as a dynamic PDF form.
    Using the same ASP code as posted by Floyd Worley, attempt to serve the PDF file with the text field populated with data.
    No luck; Acrobat Reader just crashes with an invalid memory access.

    The "result in action" posted by Garth works just fine in my browser. I attempted to serve his PDF off my server populated with data (just as a test) and it worked, so this leads me to suspect the problem is with my PDF file, not the ASP page. Could anyone supply me with a simple, *working*, editable PDF form that I could open in LiveCycle Designer to see if there's something I'm doing wrong? I can be reached at dosolkowski[at]buffalocomputergraphics.com. Thanks.
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 16, 2005 11:36 AM   in reply to (Garth_Howard)
    Hi David,
    When you open up the form in acrobat reader, did you try to export the data in the form as an XDP file (can only be done from Profesionnal) and then opening this XDP file (it should launch the corresponding PDF file merged with the data in the XDP file). If that works and your ASP test doesn't, then your problem is in the ASP part. But beware of livecycle designer, when you get into it, get ready to struggle to tons of problems and bugs.
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 16, 2005 11:51 AM   in reply to (Garth_Howard)
    Alexandre,

    I only have access to Acrobat Professional 6.0, which doesn't like even the "6.0-compatible" static PDF version of the form, and also cannot save data to XDP format. It only supports FDF or XFDF. However, the XFDF file seems to work quite nicely. Is there any reason why I could not simply generate an XFDF file programmatically to populate the form fields?
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 16, 2005 12:10 PM   in reply to (Garth_Howard)
    Actually FDF is to Acrobat forms what XDP is to Livecycle Designer's forms. It is not the same technology. I've already tried using FDF Toolkit with a form made with livecycle designer and it doesn't work.
    You can download an evaluation version of Profesionnal 7 I think.
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2005 2:34 AM   in reply to (Garth_Howard)
    This servlet should populate the fields in a designer form "DOS1.pdf (1 mainform named "f", 2 subforms named "t1 and t2" , 3 textfields)<br /><br />If you request the Servlet URL the PDF is shown, but the fields are not populated with data.<br /><br />Has someone an idea, why the data are not filled in?<br /><br />package PDFXmlData;<br /><br />import java.io.*;<br />import javax.servlet.*;<br />import javax.servlet.http.*;<br />import java.util.*;<br /><br />/** merge Acrobat Designer Docoment with <br /> *  xml Data file<br /> */<br /><br />public class Merge extends HttpServlet {<br />  public void doGet(HttpServletRequest request,<br />                    HttpServletResponse response)<br />      throws ServletException, IOException {<br />    response.setContentType("application/vnd.adobe.xdp+xml");<br />    ServletOutputStream out = response.getOutputStream();<br />    //PrintWriter out = response.getWriter();<br />    out.print("<?xml version=\"1.0\" encoding='UTF-8'?>");<br />    out.print("<?xfa generator=\"AdobeDesigner_V7.0\" APIVersion=\"2.2.4333.0\"?>");<br />    out.print("<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">");<br />    out.print("<xfa:datasets xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\">");<br />    out.print("<xfa:data xfa:dataNode=\"dataGroup\">");<br />    out.print("<f>");<br />    out.print("<t1>");<br />    out.print("<Textfeld1>Hallo</Textfeld1>");<br />    out.print("<Textfeld2>Hallo</Textfeld2>");<br />    out.print("</t1>");<br />    out.print("<t2>");<br />    out.print("<Textfeld3>Hallo</Textfeld3>");<br />    out.print("</t2>");<br />    out.print("</f>");<br />    out.print("</xfa:data>");<br />    out.print("</xfa:datasets>");<br />    out.print("<pdf href=\"http://localhost:8080/ADesigner/DOS1.pdf\" xmlns=\"http://ns.adobe.com/xdp/pdf/\" />");<br />    out.print("<xfdf xmlns=\"http://ns.adobe.com/xfdf/\" xml:space=\"preserve\">");<br />    out.print("<annots/>");<br />    out.print("</xfdf>");<br />    out.print("</xdp:xdp>");<br />    //out.flush();<br />  }<br /><br />  public void doPost(HttpServletRequest request,<br />                     HttpServletResponse response)<br />      throws ServletException, IOException {<br />    doGet(request, response);<br />  }<br />}<br /><br />*****<br />XML-Data File:<br /><?xml version="1.0" encoding="UTF-8"?><br /><f<br />><t1<br />><Textfeld1<br />>feld 1</Textfeld1<br />><Textfeld2<br />>feld 2</Textfeld2<br />></t1<br />><t2<br />><Textfeld3<br />>feld 3</Textfeld3<br />></t2<br />></f<br />>
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2005 9:58 PM   in reply to (Garth_Howard)
    I looked at the problem one more time and found the error. If I omit then annot-Tag then the data are populated in the form.

    In the next step I rewrote the servlet, so that you can name the Datafile as Url Parameter and the servlet sends form an data back to the client. Notice, the name of the pdf is part of the xdp.

    package PDFXmlData;

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;

    /** merge Acrobat Designer Document with
    * xml Data file
    */

    public class Merge extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("application/vnd.adobe.xdp+xml");

    String xmlFileLocation = request.getParameter("xmlFile");
    if ( xmlFileLocation == null) {
    // Error handling ...
    return;
    };

    String file = getServletContext().getRealPath(xmlFileLocation);
    try {
    BufferedInputStream in =
    new BufferedInputStream(new FileInputStream(file));
    ByteArrayOutputStream byteStream =
    new ByteArrayOutputStream(512);
    int nRead;

    while ((nRead = in.read()) != -1) {
    byteStream.write(nRead);
    }
    in.close();

    response.setContentLength(byteStream.size());
    byteStream.writeTo(response.getOutputStream());
    }
    catch(IOException ioEx) {
    }
    }

    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    }
    }
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 4, 2005 7:52 AM   in reply to (Garth_Howard)
    Hi,<br />i've got similar problem, here is my php code:<br /><br /><?php<br />header("Content-Type='application/vnd.adobe.xdp+xml'");<br />echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";<br />echo "<?xfa generator=\"AdobeDesigner_V7.0\" APIVersion=\"2.2.4333.0\"?>";<br />echo "<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">";<br />echo "<xfa:datasets xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\">";<br />echo "<xfa:data>";<br />echo "<TSP301>";<br />echo " < form > ";<br />echo " < text > sampletext < /text > ";<br />echo "< /form >";<br />echo "</TSP301>";<br />echo "</xfa:data>";<br />echo "</xfa:datasets>";<br />echo "<pdf href=\"http://mercury:8080/sample/dane.pdf\" xmlns=\"http://ns.adobe.com/xdp/pdf/\" />";<br />echo "<xfdf xmlns=\"http://ns.adobe.com/xfdf/\" xml:space=\"preserve\" >";<br />echo "<annots/>";<br />echo "</xfdf>";<br />echo "</xdp:xdp>";<br />?><br /><br />also, i've got simplest pdf on the server (Apache 2) with only one text field, and the all i get in firefox or ie is:<br /><br />sampletext<br /><br />it's only a text, it do not open pdf and load it with data but when i get the source of the page i see all this data wich i 'echo' from php script<br /><br />where i make mistake, maybe someone can show me working php code to preload pdf with data<br /><br />£ukasz
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 11, 2005 6:54 AM   in reply to (Garth_Howard)
    hi
    I have a Web Page With PDF and asp, and write same example of here but
    The asp page brings up the pdf file but the data does not seem to load
    The file xdp is good, but not load in my Web PDF when use my asp

    Why that problem?

    Thanks for your help
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 15, 2005 9:02 AM   in reply to (Garth_Howard)
    Guys:<br />HEre is the code snippet that works.  I tried it with ASP.NET and with Acroba Professional 7.0 installed on the local box.<br />     public class WebForm1 : System.Web.UI.Page<br />     {<br />          private void Page_Load(object sender, System.EventArgs e)<br />          {<br />               string temp = "";<br /><br />               StringBuilder responseString = new StringBuilder();<br />               Response.ContentType = "application/vnd.adobe.xdp+xml";<br />               responseString.Append( "<?xml version='1.0' encoding='UTF-8'?>");<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 xfa:dataNode='dataGroup'>");<br />               StreamReader sr = File.OpenText("c:\\inetpub\\wwwroot\\CaptureAcrobat\\PersonalInfo_dat a.xml");<br />               string xmldata = sr.ReadToEnd();<br />               sr.Close();<br />               responseString.Append(xmldata);<br />               responseString.Append("</xfa:data>");<br />               responseString.Append("</xfa:datasets>");<br />               responseString.Append("<pdf href='http://localhost/CaptureAcrobat/PersonalInfo.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br />               responseString.Append("<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>");<br />               responseString.Append("<annots/>");<br />               responseString.Append("</xfdf>");<br />               responseString.Append("</xdp:xdp>"); <br /><br />               Response.Write(responseString);<br />               Response.Flush();<br />               Response.End();<br />               }<br /><br />}
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 22, 2005 2:33 PM   in reply to (Garth_Howard)
    lakshmin Ramakrishnan,

    Could you help me a little here? I followed your Dot.NET code. Also created PDF and xml files. However, when I viewed the aspx file, I got some xml parse error message and did't see the pdf either.

    I must missed something. Your help will be very appreciated!!!
    Thanks in advance.
    Jie
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 14, 2006 12:35 AM   in reply to (Garth_Howard)
    I could not agree more! I have been so frustrated just tring to populate a PDF with XML, what should be a simple thing.... I also am having trouble with the example code from post 22. Any additional advise may end my suffering! Thanks much, Brian
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 16, 2006 12:26 PM   in reply to (Garth_Howard)
    I did exactly what you did.
    Borwser is loading with the appropriate PDF but not with the values.
    Could you please send working copy to me.
    Thanks again.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 16, 2006 3:25 PM   in reply to (Garth_Howard)
    I am hoping to figure this one out eventually.  I wish they had an example that walked you through whole process.<br /><br />I created the following code. My form appears without the field being populated also. I went into designer pull up the pdf added some data and tried to export the data as xml and xdp. The xml shows with no data. Tried to open xdp its say unable to locate template. <br /><br />Is this xml correct? (this is being used in designer to perform the <br />binding <br /><?xml version="1.0" encoding="UTF-8"?> <br /><TextField1><value>Howard</value></TextField1> <br /><br />After I have binded the field <br /><br />I use the following asp to display the pdf with <br />the one field filled in. <br /><br />Is this xml correct? <br /><br /><% Response.ContentType = "application/vnd.adobe.xdp+xml" response.write "<?xml version='1.0' encoding='UTF-8'?>" <br />response.write "<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.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 xfa:dataNode='dataGroup'>" <br />response.write "<TextField1><value>Howard</value></TextField1>" <br />response.write "</xfa:data>" <br />response.write "</xfa:datasets>" <br />response.write "<pdf href='http://159.83.96.138/prod/myFirstShot.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />" <br />response.write "<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>" <br />response.write "<annots/>" <br />response.write "</xfdf>" <br />response.write "</xdp:xdp>" <br />Response.Flush <br />Response.End <br /><br />%>
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2006 7:50 AM   in reply to (Garth_Howard)
    Garth,
    In step 2 of your resolution, you mentioned to use data binding feature.
    I want to know... is it (the data connection part) to be done just for testing purpose or whether it has any significance in actually generating dynamic PDF.

    I am asking this question, 'cause in my case, I do not have separate XML data file. I am creating XML name value pairs in code and included that in XDP code.

    Another question. What should be the "Return Method" be set to, when creating PDF form.
    Fill then Submit (OR) Fill the Submit/Print (OR) Fill then Print (OR) Print

    My requirement is same as yours except for XML data file which I mentioned above.

    Any pointers would be of great help.

    Thanks
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2006 7:59 AM   in reply to (Garth_Howard)
    This has been an EXTREMELY helpful thread. I was able to get this concept working. Does anyone know if its possible to force this file to save as a PDF rather than prompting the user to open or save?
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2006 12:23 PM   in reply to (Garth_Howard)
    I should have included in my message that I understand that it could not automatically save on the client (as this would be a big security no-no) -- I'm looking to then save it on the server.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 13, 2006 7:41 AM   in reply to (Garth_Howard)
    This posting saved me a lot of time and i want to thank everyone that contributed to it.
    I have noticed that when the XML data is formatted incorrect, the errors reported are vague and IE browser takes long time to recover from error.
    I am still looking for some more information on the possiblity of locking or hiding certain selected fields. In other words, based on a policy I would like to display a PDF document with data filled but the fields locked or hidden so that either user can not edit or can not see. I know that I can do this with the template itself but that is not what I want as this information (about fields locked/hidden) is not static but dynamic and set by an Administrator.
    Any useful information regarding this issue will be greatly appreciated.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2006 8:15 AM   in reply to (Garth_Howard)
    Ravinder, were you actually able to get your PDF Document (Form) to load with data?  I have not been able to get my .NET page to populate my PDF document - the PDF loads in my Browser but has no data.  If you can post sample code that you were able to get to work, it would be appreciated, or if you notice something wrong with my code below, please let me know.<br /><br />Also, when my PDF document loads in my browser, I am prompted to "Open or Save" my .xdp file and if I click "Open", my PDF Form loads, but the fields are not populated.  How do I stop this prompt from loading?  I don't want the user(s) to be able to see this.<br /><br />My .NET page and XML file are listed below:<br />------------------------- .NET -----------------------------------<br />Imports System.Text<br />Imports System.IO<br /><br />Public Class WebForm1<br />    Inherits System.Web.UI.Page<br /><br />#Region " Web Form Designer Generated Code "<br /><br />    'This call is required by the Web Form Designer.<br />    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br /><br />    End Sub<br /><br />    'NOTE: The following placeholder declaration is required by the Web Form Designer.<br />    'Do not delete or move it.<br />    Private designerPlaceholderDeclaration As System.Object<br /><br />    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<br />        'CODEGEN: This method call is required by the Web Form Designer<br />        'Do not modify it using the code editor.<br />        InitializeComponent()<br />    End Sub<br /><br />#End Region<br /><br />    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />        'Put user code to initialize the page here<br /><br />        Dim responseString As New StringBuilder<br />        Dim sr As StreamReader<br />        Dim xmldata As String<br /><br />        Response.ContentType = "application/vnd.adobe.xdp+xml"<br />        responseString.Append("<?xml version='1.0' encoding='UTF-8'?>")<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 xfa:dataNode='dataGroup'>")<br />        sr = File.OpenText("c:\\inetpub\\wwwroot\\PDFFiller\\TestForm_data.xml")<b r />        xmldata = sr.ReadToEnd()<br />        sr.Close()<br />        responseString.Append(xmldata)<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("<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>")<br />        responseString.Append("<annots/>")<br />        responseString.Append("</xfdf>")<br />        responseString.Append("</xdp:xdp>")<br /><br />        Response.Write(responseString)<br />        Response.Flush()<br />        Response.End()<br /><br />    End Sub<br /><br />End Class<br /><br />----------------------End .NET -----------------------------------<br /><br />--------- XML (TestForm_data.xml) --------------------------------<br /><form1><txtFirstName>Homer</txtFirstName><txtLastName>Simpson</txtL astName></form1><br />----------------------End XML -----------------------------------
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2006 2:18 PM   in reply to (Garth_Howard)
    With a lot of trial and error, here is the revised code that I got to populate my PDF form:<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()
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2006 7:13 AM   in reply to (Garth_Howard)
    I'm worried.

    Is this approach described in any official Adobe documentation? PDF and XDP are open specs, right? Where is all this specified? With which versions of Reader/Acrobat does this work? Can we rely on this approach working in future versions?

    The main source of my concern is this. The ability to merge XML data with PDF forms on a server is the main feature of Adobe LiveCycle Forms, a server product that sells for tens of thousands of dollars. Why would Adobe create and support a means of pre-filling forms that doesn't provide any revenue for them? It makes one question the value/purpose of Adobe LiveCycle Forms (the server product).

    I see that the PDF packet in this xdp provides the PDF itself by reference. I wonder if you could also provided it as a base-64 encoded string. I wonder too if you could include the XDP template as well. If so, what happens when the XDP template that you include doesn't match up with the PDF node. What does Reader display?

    Thanks to all who have contributed to this very useful and thought-provoking thread.

    Jared Langdon
    www.jlangdon.ca
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2006 9:26 AM   in reply to (Garth_Howard)
    This is in no way an official Adobe Response, just my opinion.

    I don't see the ability to things this way taking away from the value of LC Forms at all. LC Forms provides so many more advantages.

    - Supportability: What happens if you use this way and go to production and everything dies at some point. Who do you go to for help? You haven't bought any enterprise product, so you don't have a support contract. So you can be pretty screwed.

    - Maintainability: LC Forms provides a nice API that allows you to write maintainable code. I'm not sure you can say the same about code that prints a whole bunch of hard coded strings to a response object in anything but simple cases. Not to mention it takes a whole lot longer to code.

    - Future Support: What is the XFA spec changes and it makes your code stop working? You have to rewrite your code. If you have Forms then if the spec changes the code in Forms changes and you don't have to rewrite anything.

    - Documentation: Short of reading the XFA spec I don't think there is any.

    Value add features:

    - What if you want to create a PDF that makes a web service or DB call? Using this method you'd have to buy Reader Extensions which can be significantly more expensive. With Forms you could do these server side and not have to buy anything else.

    - Forms can output to multiple output formats. Currently only HTML and PDF. But what if a cool new format is added and you want to use it? You can't.

    - What if you having digital signatures on your PDF? You need to submit the entire PDF. But what if you want some server logic to run based on other data in the form. How do you get the data from the PDF.

    etc, etc, etc.

    In the end I think it's a good that this option is available for people who don't have the budget or who are doing very simple things for which an enterprise product would be overkill. I wouldn't expect many people looking for enterprise solutions to choose this route over buying LC Forms (again, just my opinion... maybe I'm wrong..)

    Chris
    Adobe Enterprise Developer Support
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2006 9:30 AM   in reply to (Garth_Howard)
    Btw, if you guys generate your own XFA like this, you should not be specifying Designer as the xfa generator. Designer is not generating this XFA, you are.

    Chris
    Adobe Enterprise Developer Support
     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2007 9:54 AM   in reply to (Garth_Howard)
    What should be specified if not Designer? Can you provide the the xfa:generate tag should look like?
     
    |
    Mark as:
  • Currently Being Moderated
    May 9, 2007 9:48 AM   in reply to (Garth_Howard)
    Great Discussion!<br /><br />Another question here tat might be relevant...<br /><br />Is there a way to make an XDP document stand alone? I know XDP requires the <pdf href=""> tag, but what if we want to send the filled out XDP file to someone who does not have access to the href location? Is there a way we can embed the PDF into the XDP so it is a self contained unit?<br /><br />Thanks,<br />Bob
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)