Print Page | Close Window

Updating fields on a LiveCycle form using Delphi

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1259
Printed Date: 22 Nov 24 at 7:17PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Updating fields on a LiveCycle form using Delphi
Posted By: zbrd
Subject: Updating fields on a LiveCycle form using Delphi
Date Posted: 25 Oct 09 at 3:42PM
I am using LiveCycle 8 to create a form.  I am utilizing QPDF 7.15 and Delphi 7 under WinXP.
 
I want to use LiveCycle to create a form because the form design is very easy and fast.  The form doesn't have to have complex code, but it does have graphics, lines and text fields in it.
I then want to use this form as a template and copy it to a new name before updating the new form with QPDF calls.
After creating new form (from the template) I need to update the fields from Delphi7.  I can not get this to work.  I am trying to grab the fields by name, update and save but I can't seem to get it to find the fields.  Here is the simple code I am trying to use:
 
if UnlockResult = 1 then begin
       FileHandX := PDF.LoadFromFile(TestFName);
       if (FileHandX = 0) then
           // Error message goes here
       PDF.SetNeedAppearances(1);
       wkInt := PDF.SetFormFieldValueByTitle('form1.Page1.Body.xAccountName1', 'Testing PDFLib by filling in Account Name');
       PDF.UpdateAppearanceStream(1);
       SaveRC := PDF.SaveToFile(TestFName);
       if (SaveRC = 0) then
           // Error message goes here
 
I have tried several combinations of the field name but still it does not update the field.  It does save the document and I can open in Reader.
 
Any help would be appreciated.



Replies:
Posted By: conner
Date Posted: 02 Nov 09 at 2:12PM
First argument for UpdateAppearanceStream is index number to the field, is 'form1.Page1.Body.xAccountName1' your only form field? You can use FindFormFieldByTitle to get index i believe.

Dont really know about LiveCycle but could it be it uses XFA, tried SetXFAFormFieldValue? What does FormFieldCount and GetXFAFormFieldCount return?
 
Tried listing the names in the document, is there in fact a 'form1.Page1.Body.xAccountName1'?
for i := 1 to QPDF.FormFieldCount do
  Memo1.Lines.Add( FQPDF.GetFormFieldTitle(i) );
Dont know if this helps


Posted By: zbrd
Date Posted: 02 Nov 09 at 4:04PM
Thanks,
I was able to get it working by using the FindFormFieldBy Title then SetFormFieldValue with the index.  I do find it interesting I have to use the full name for these LiveCycle forms (ie 'form1[0].Page1[0].xAdministrator1[0]').
I would have thought the name without the LiveCycle index would have worked.
 
I then flatten the fields at the end of updating.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk