Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How Can I Programmatically populate Form Fields and print ?

Not applicable
Hello



I am not a new programmer but this has been a surpisingly difficult issue.

I hope that someone can help me to do what should be quite straight forward.

Can I be missing something ?



---

What i am trying to do is :



Develop a C# program which runs on a client computer to:



1. Read through a number of internal source files. (format variable)

2 - read an Adobe Acrobat 9.0 PDF form which is authored and supplied by a state or federal governmental agency.

3. locate uniquely named text fields in the PDF file specification or document tree that can be programmatically updated with the specific information needed for each field as records are processed.

4. Print out each form after it is updated.



It is my understanding that this might be able to be accomlished using

XFA and XDP but that there may be some unique processing requirements on my part .... requirements not clear ... this is anecdotal information as I have no written information except the XFA specification doc doesnt necessarily help me with accessing the PDF information directly until I read more



I am hoping that my requirement is clearly stated so that I can be told if I am close to the correct approach using Adobe SDk's or utilities - Since I do not know what is available



I am quite versed using XSD and XML and feel comfortable with the possibility that I might be able to do this... but i need to have a bit more information and i am hoping that this is the place to get it .



I use XSD to help automate application development and I can see where this would be useful for PDF forms but the information is very sprarse on usage issues.



This is as far as I have gotten and it has taken me far longer than I would have ever imagined to learn only this much information



I appreciate any assistance with this matter

Thanks
16 Replies
Not applicable
Update Note:

-------------------

I know what XML serialization does and how XSD is used in this process .... I gues what i cant seem to find out is how - I get a very large xml data file to be read appropriately by the PDF form.



I have an XML schema and I can edit the PDF to match the schema field names - but I don't know what to do next



If this were a C# program I could easily proceed using xsd commands to the pre-process to bind the xml field names to the classes in the appropriate namespace .
Not applicable
Would it be possible for me to create my own XML output - both schema and data to be used by a locally edited PDF file ????



basically - I am wondering if I can create my own schema and the associated xml data from the various and variable sources that are necessary to fill out the form. Then edit the PDF file locally with filed names to match the newly derived schema and then print the forms as required.
pguerett
Level 10
Level 10
You can create your own schema and by importing it into the form design you can bind whatever fields you want to differnet nodes in the schema. Now when you export data the xml will follow the format of the schema. So this allows you to have a field on your form of a specific name but when exported it would be in a node in the xml with a completly different name.
Not applicable
basically - I am wondering if I can create my own schema and the associated xml data from the various and variable sources that are necessary to fill out the form. Then edit the PDF file locally with matching field names to match the newly derived XML schema and then print the forms as required.
pguerett
Level 10
Level 10
The schema must be created ahead of time. You cannot create the schema on the fly. Once it is created you can bind individual nodes in the schema to fields on the form. Printing has nothing to do with this process ....and yes you can print at anytinme.
Not applicable
Thank you. I appreciate it .



I have access to a schema -



But all i have been able to do, (more or less), is - to create a PDF from the schema - the fields have the correct names. etc ... but

I am still not catching how to actually pre-populate the form itself - using the actual XML data that adheres to the schema.

I have tried several times - and proably will several more times to do this but it is not readily apparent or readly described in ANY of the adobe literature -

how to get it to autoread a long XML datafile which adheres to a schema.

so far, all I can get it that - it will create a form based on the schema - and where the XML data source data gets read is not being mentioned - so that I can understand it.



At this point, If I was able to get the PDF created from the schema to print one by one - with an operator required to click the button -

i would consider it a major achievement.

I hope that you are able to assist me in accomplishing this

afterwards I can research what it might take to do this programmatically



Thank you
pguerett
Level 10
Level 10
Ok Now I get it ...I assume that you have a sample data file that you want to bring in to the form. You can open the file in Acrobat/Reader and Under the Forms menu choose Manage Form Data/Import Data. You can pick the file and then the merge will happen.



You can also add a button to your form and in the click event you can add this code:



xfa.host.importData();



When the user hits the button a dialog will come up and allow the user to choose a file to import.



Note that in both cases the file must be XML and needs to follow the schema you mentioned.



If you want to serve up the form and have data in it you will need to do this from LiveCycle Forms on the server side.
Not applicable
OK - this is good -

Thank you ...

I am using a form prepared by a governmental agency

The schema is as well

but Live Cycle doesnt recognize it or something because the use XML Data Root Element name- is unusable .

nothing shows up in the dropdown and I cannot type in anything either -

SO i can't embed the schema or is this step even necessary to do what I want ?

I had supposed that I needed to embed the schema in the document - but i'll give it a try without trying that step



Thanks ..
pguerett
Level 10
Level 10
No need to embed the schema but you must import it into the dataview to do the bindings.
Not applicable
Thank you for your help

I was able to get somewhere - not too far - mind you - but some forward progreess here.



After checking over the schemas that I have access to -

I have found out that no schema exists for a few of the really common reportings that I will be needing to present.



But these reports are quite simple just a few forms

and relatively little text ....



so I think that I will wing it and create a simple schema - and generate my own simple XML data - and generate an acceptable PDF form for that purpose .



I Thank you kindly for the help..



Cheers;
Not applicable
Paul - I appreciate your help on this issue;



But after re-reading and re-trying all that we have discussed and all that i am reading about in the Adobe documentation.



I am afraid that I am still not able to do anything more than to

to generate a form from either a schema or from an XML data file -

Live Cycle designer appears to read this without any problem

Where I have difficulty is :

After designing the form - I cannot access another data connection The manage form data dialog grays out both XML form data and XML schema once I have created the form .

So - if I delete the connection after generating the form fields - then it wont load correctly stating that there is no mention of a data file.



The ShipOrder example supplied with the Designer appears to work properly - but I cannot get my own form to do anything like it -

I am studying this problem using the documentation available but I must be missing something

would it be possible for you to do a basic - walk through - of the process - so I can see If I am missing anything ?



I will describe my process - and then please correct me if I am making any errors.



1. Create a blank form using the designer

then in Manage Form Data palette

2. Create a new data connection

- select schema - do not embed schema

3. in Manage Form Data palette - select generate fields

- watch fields appear on form Design view

4. Adjust fields , etc.

5. ...... here is where nothing I do helps me to populate the fields with data.



- Please help



Thanks
pguerett
Level 10
Level 10
The schema merely describes the structure for the data ...it does not have data in it. A separate XML file that conforms to th eschema is required. If you want to see this work, you can look at the Preview tab under the File/Form Properties tab and you can enter a path to your data file. When you preview in Designer it will merge the data on to the template and show you in the rendered PDF.



Or you could save your form as a PDF and use the Advanced/Form/Import Data menu item to select the file and bring the data into the form after it is loaded in Acrobat.
Not applicable
I do understand the role that the schema plays.

I have a schema and I am using it to create a form and that works -

The I will (hopefully ) load in records from an XML data file that adheres to the schema.



And I actually have used the dynamic forms example supplied with ES designer and that works - wonderfully

That is exactly the behavior that I am trying to create - only I can't seem to create it

no matter what i do and how often I read and re-read thge information supplied by Adobe .



What is happening is this :



1. I Create a blank form using the designer

then in Manage Form Data palette

2. Create a new data connection

- select schema - do not embed schema

3. in the Manage Form Data palette - select generate fields

- watch fields appear on form Design view - This is working great !

4. Adjust fields , etc.

5. ...... here is where nothing I do helps me to populate the fields with data.



I now unable to access a second data source to read XML data into the form -

I cannot say why this is happening -

It is appparently supposed to be happening -

there are even examples supplied by Adboe that do what I am trying to do - I just cant seem to make it happpen

So What I am looking for is a little assistance that can take me from whaere I am and what I know now to where I need to be and supplies me qwith what I do not know

namely:

how to create an XDP form which will read in XML data according to a schema

I am looking for a step by step example that will do this



- Please help
Not applicable
Where I have difficulty is :

After designing the form - I cannot access another data connection The manage form data dialog grays out both XML form data and XML schema once I have created the form . So - if I delete the connection after generating the form fields - then it won't load correctly stating that there is no mention of a data file.



The ShipOrder example supplied with the Designer appears to work properly - And this is precisely the behavior I am trying to emulate but I cannot get my own form to do anything like it -

I am studying this problem using the documentation available but I must be missing something.

Wuld it be possible for you to do a basic - walk through - of the process - so I can see If I am missing anything ?
Not applicable
I have updated the Form / Properties - Information and the file is found, etc - but the individual fields in the data file do not appear -

........ ??

The data remains the same as in the data view ..
Not applicable
FYI - and mine too 🙂



To create a data connection and embed a schema into a form design:

1. Select Edit > New Data Connection. The New Data Connection dialog box appears.

2. In the Get Data Description From list, select XML Schema and click Next.

3. Beside the Select XML Schema File box, click Browse . The Open XML Schema File dialog box

appears.

4. Select LiveCycle ES Server > Schemas > mortgageLoanSchema.xsd [#1.0] and click OK.

5. In the New Data Connection dialog box, select Embed XML Schema, and then click Finish. A list of fields

appear in the Data View palette.

Note: Select Palettes > Data View if the Data View palette is not visible.

6. Save your form design.

You have imported and embedded a schema into your form design. The Data View palette should look like

this illustration:

➤ To add fields to the form design using a schema:

1. Drag MortgageFields from the Data View palette onto the left side of your form design, below Step1:

Mortgage Information:. A group of fields appear, based on the schema. The data connections will be

set for each field automatically.

Note: If the message stating There is insufficient space on the form for the pasted content appears,

click OK and move the group of fields closer to the left border.

2. With the group still selected, hold down the Control key and select the Step1: Mortgage Information:

object.

3. Select Layout > Align > Left.

4. Select Insert > Unwrap Subform so that these fields are no longer grouped together. This step makes it

easier to reposition individual fields later in this tutorial.