gcue Posted September 21, 2020 Share Posted September 21, 2020 I was able to reference a form field and use this script to write to the specific form field in a PDF - thanks ReFran! I would like to just be able to read a specific form field in a pdf. seems like it would be easier but cant get the syntax right. I have acrobat pro. $App = ObjCreate("AcroExch.App") ;; start Adobe Acrobat $App.Show ;; show Acrobat or comment out for hidden mode ;; actions $AVDoc = ObjCreate("AcroExch.AVDoc") ;; connect to Ac Viewer If $AVDoc.Open($FilePath,"") Then ;; open the file $PDDoc = $AVDoc.GetPDDoc ;; get PdDoc from AvDoc $AForm = ObjCreate("AFormAut.App") ;;connect to AForm API $EX = "" _ & ' var f = this.getField("'& $fieldname &'")' & @LF _ ;~ & ' f.value = "hello"' & '"' & $test = '" f.value' ;this is where i need help! ;msgbox(0,"",$ex) $AForm.Fields.ExecuteThisJavaScript($EX) ;;execute the Js-Code ;~ $PDDoc.save(1,$fileOut) ;~ $app.closeAlldocs() $app.exit() Else msgbox(0,"","Coudn't open report") endif ;; release objects $AForm = 0 $AvDoc = 0 $PdDoc = 0 $App = 0 Link to comment Share on other sites More sharing options...
GMK Posted September 23, 2020 Share Posted September 23, 2020 (edited) $App = ObjCreate("AcroExch.App") ;; start Adobe Acrobat $App.Show ;; show Acrobat or comment out for hidden mode ;; actions $AVDoc = ObjCreate("AcroExch.AVDoc") ;; connect to Ac Viewer If $AVDoc.Open($FilePath,"") Then ;; open the file $PDDoc = $AVDoc.GetPDDoc ;; get PdDoc from AvDoc $JSO = $PDDoc.GetJSObject ;; get JS Object from PDDoc $test = $oJSO.GetField($fieldname).Value ;; get field value msgbox(0,"",$test) ;~ $PDDoc.save(1,$fileOut) ;~ $app.closeAlldocs() $app.exit() Else msgbox(0,"","Coudn't open report") endif ;; release objects $JSO = 0 $PdDoc = 0 $AvDoc = 0 $App = 0 Edited September 23, 2020 by GMK Forgot to release objects gcue 1 Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2020 Author Share Posted September 24, 2020 works great!!!!!! thank you VERY VERY much!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now