Run Clears Text Fields

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
lewisv
Posts: 6
Joined: Mon Jun 18 2007

Run Clears Text Fields

Post by lewisv » Fri Apr 24 2009

I am trying to open a file, set the values in some form text fields, then put the pdf back into run mode so that the user can not change the looks ( but can still edit the form fields )
But when I try to set the pdf into run mode all my fields clear out.

Here is some sample code
System.Collections.ArrayList arList = (System.Collections.ArrayList)m_pdf.GetPage(1).Attribute("Objects").Value;

m_pdf.DoCommandTool(IacCommandTool.acCommandToolDesignMode);
foreach (Amyuni.PDFCreator.IacObject obj in arList)
{
if (obj.Attribute("ObjectType").Value.ToString() == "6")
obj.Attribute("Text").Value = "New Value";
}
m_pdf.Refresh();
m_pdf.DoCommandTool(IacCommandTool.acCommandToolRunDocument);

What am I doing wrong?

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Run Clears Text Fields

Post by Joan » Wed Apr 29 2009

Hello,

Fields have two values for the text in side them: "Text" and "Value"

'Text' is what appears when the document is in design mode, while 'value' is what appears when the document is in Run mode.

So it is normal that if you set the Field.Text value and you go to Run mode the fields get cleared.

Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark

lewisv
Posts: 6
Joined: Mon Jun 18 2007

Re: Run Clears Text Fields

Post by lewisv » Wed Apr 29 2009

Ok, that seems to work, but on a follow up note.

Should I set only the value field, or should i set both the text and value fields?
What exactly is the difference?

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Run Clears Text Fields

Post by Joan » Thu Apr 30 2009

Hello,

You can set both the value field and the text field, these are two different attributes.

However to capture data entered by the users in your forms you will be using the value attribute to retreive the data in the fields.

The text attribute is used to enter a formula in the field or some records taken from a database if the pdf file is connected to a database. The result of the forumla used or the records read from a database is stored in the Value attribute of the field in run mode. So in this case the Text attribute will contain the forumla itself (example = hourly rate * number of worked hours) and the value will be the corresponding data fetched from a database.


Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark

Post Reply