Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add a Field to PDF Document
Message
From
22/10/2009 14:27:29
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Add a Field to PDF Document
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01430745
Message ID:
01430745
Views:
109
It appears that Acrobat has changed to way some automation functions work between Version 8 and 9.

I have had code that added fields with javascript in them to act as a date stamp when the document was printed. The functions I had working added these fields in the background without the PDF actually becoming visible. Now I understand to use the AFormAut.App features requires the document be visible in the viewer.

However, There is supposed to be a way to use JavaScriptObject to do this in the background but I cannot get it to work. The addField generates an error Invalid Argument Type...

Can someone help with this?
Local whatDrawingNumber
whatDrawingNumber = "C:\862148-001C.pdf"

Local ispdffilee, array1

DIMENSION array1(4)

ispdffilee = .F.
ON Error

	avDocMM = CreateObject("AcroExch.PDDoc")
	
	If File(whatDrawingNumber) = .T. Then
		ispdffilee = avDocMM.Open(whatDrawingNumber)

		If ispdffilee = .T.
			
			jse3MM = avDocMM.GetJSObject
			dfrnopMM = jse3MM.numPages
			
			STORE 50 TO array1(1)
			STORE 20 TO array1(2)
			STORE 450 TO array1(3)
			STORE 0 TO array1(4)
			
			For x = 0 To dfrnopMM - 1
				jse4MM = jse3MM.addField("test","text",0,array1)
					
			Next x
			
			avDocMM.Close()
			
		Else
		
			avDocMM.Close()
			
		EndIf
	Else
		
		avDocMM.Close()
		
	EndIf
Reply
Map
View

Click here to load this message in the networking platform