Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PDF Form Viewing, Field Editing and Printing
Message
From
26/10/2004 11:12:19
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00953565
Message ID:
00954560
Views:
36
Researching the SDK I found a vb example that I modified to work with VFP and now I am able to grab the values of form fields using automation as well as javascript. Here is quickie example:
*--Requires the pdf form test.pdf with the following formfield names (all
*--are case sensitive):

*        "AGENCY.NAME"
*        "AGENCY.ADDR1"
*        "AGENCY.CITYSTZIP"


sFieldName  = "AGENCY.NAME"
sFieldName2 = "AGENCY.ADDR1"
sFieldName3 = "AGENCY.CITYSTZIP"

AcroExchAVDoc = CreateObject("AcroExch.AVDoc")

sfileName = "C:\acordforms\test\test.pdf"
IF !FILE(sFileName)
	=MESSAGEBOX('Cannot locate: '+sfilename)
	sFileName=GETFILE('pdf','PDF File:','Open',1,'Please select a pdf file with the formfield AGENCY.ADDR1')
	IF !FILE(sFileName)
		=MESSAGEBOX('Cannot locate: '+sfilename)
		RETURN
	ENDIF
ENDIF

AcroExchAVDoc.Open(sFileName, "")
AcroForm = CreateObject("AFormAut.App")
AcroFields = AcroForm.Fields

*--Get the value of the first field AGENCY.NAME in our test.pdf
AcroField  = AcroFields.Item(sFieldName)
*--Get the value of the 2nd field AGENCY.ADDR1 in our test.pdf
AcroField2 = AcroFields.Item(sFieldName2)

MESSAGEBOX(PADR(PADL("FORMFIELD AGENCY.NAME value:",40),80)+CHR(13)+AcroField.Value+CHR(13)+CHR(13);
          +PADR(PADL("FORMFIELD AGENCY.ADDR1 value:",40),80)+CHR(13)+AcroField2.Value,0+64+4096,"Value Retrieved by Automation")

*--Get the value of the citystzip formfield using javascript
sJS = "event.value = this.getField("+"'"+sFieldName3+"'"+").value;"
sValue = AcroForm.Fields.ExecuteThisJavaScript(sJS)

=MESSAGEBOX(PADR(PADL("AGENCY.CITYSTZIP value:",40),80)+CHR(13)+sValue+CHR(13),0+64+4096,"Value Retrieved by JavaScript")
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform