Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 87055

Re: How can I add javascript text fields to Acrobat pages from Applescript please?

$
0
0

G'day

 

Unfortunately I don't have the API. My Adobe Reader installation updating to version XI failed, and subsequent attempts to fall back on the X version are blocked by the partial install of XI. Damn Adobe stuff.

 

Could someone please post the relevant part of the API to give me some pointers, please.

 

I ha mucked about with some information I found on the Web, and come up with the following, which fails because I can't work out how to address the current document with the variable myDoc.


Regards, Brian


setParamstoParams& "var myDoc = this;" & return



setTempAttachmentNameto "(20140717121212Z)"

setPreserveFileNameto "This is a test"

setbypasstofalse

 

tellapplication "Adobe Acrobat Pro"

  activate

  setCountOfPagestocountofpages

  repeatwithPageCounterfrom 1 to 1 # CountOfPages

  tellapplication "System Events" totellprocess "AdobeAcrobat"

  try

  clickmenu item "Page..." ofmenu 1 ofmenu item "Go To" ofmenu 1 ofmenu bar item "View" ofmenu bar 1

  tellcurrent applicationtodelay 0.1

  keystrokePageCounterastext

  tellcurrent applicationtodelay 0.1

  keystrokereturn

  ifnotbypassthen

  myADDHeaderFooter(TempAttachmentName, PreserveFileName& " " & CountOfPages, PageCounter)

  endif

  endtry

  endtell

  endrepeat

endtell

 

onADDHeaderFooter(The_String1, The_String2, currentPage)

  tellapplication "Adobe Acrobat Pro"

  activate

  setmyDoctodocument 1

  tellmyDoc

  tellpagecurrentPage

  setcboxtocrop box

  setitem 2 ofcboxto (item 2 ofcbox) + 44

  setitem 4 ofcboxto (item 4 ofcbox) - 44

  setmedia boxtocbox

  setcrop boxtocbox

  settheResult1tomyAdd_WaterMarkText(The_String1, "IDAutomationHC39M", 12, 1, 1, 1, 0, 3, 10, 3, 0, myDoc)

  do scripttheResult1

  settheResult2tomyAdd_WaterMarkText(The_String2, "Times", 16, 1, 1, 1, 0, 4, 10, -6, 0, myDoc)

  do scripttheResult2

  endtell

  endtell

  endtell

endADDHeaderFooter

 

onAdd_WaterMarkText(cText, cFont, nFontSize, nS, nE, nTA, nHA, nVA, nHV, nVV, nR, myDoc2)

  #set Params to "var myDoc = app.newDoc();" & return

  setParamsto ""

  setParamstoParams& "var myDoc = this;" & return

  setParamstoParams& "var inch = 72;" & return

  setParamstoParams& "var Bbox = this.getPageBox(" & "\"Crop\"" & ");" & return

  setParamstoParams& "var f = myDoc.addField(" & "\"Text1\"" & ", " & "\"" & cText& "\"" & ", 0, [72, Bbox[1]-inch, Bbox[2]-2*inch, Bbox[1]-2*inch ] );" & return

  setParamstoParams& "f.strokecolor = color.black;" & return

  setParamstoParams& "f.richText = true;" & return

  setjavascripttoParams

  returnjavascript

endAdd_WaterMarkText


Viewing all articles
Browse latest Browse all 87055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>