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