If I hilite the inserted text, I can manually reset it to Code 128.
I’m trying to see if the ‘Use of Arbitrary Fonts’ will make a difference, but cannot work out how to address the text box, to get any different Font value or name. I suspect from the Dictionary that no command is available, and don’t have the foggiest how to get the box and it’s font name from _javascript_.
I’m sorry to be a nuisance, but this version of Acrobat is driving me mad! Hellllllllp, please!
tell application "Adobe Acrobat"
activate
set p to 1
tell document 1
tell page 1
set cbox to {}
if cbox = {} then set cbox to crop box
if cbox = {} then set cbox to bounds
if cbox = {} then set cbox to media box
if cbox = {} then set cbox to art box
if cbox = {} then set cbox to trim box
if cbox = {} then set cbox to bleed box
set p to 4
set pageTop to (item 2 of cbox) + 36
set p to 5
set item 2 of cbox to pageTop
set p to 6
set pageBottom to (item 4 of cbox)
set p to 7
set item 4 of cbox to pageBottom
set p to 8
set bounds to cbox
set p to 9
set media box to cbox
set p to 10
set crop box to cbox
set p to 11
set trim box to cbox
set p to 12
set bleed box to cbox
set p to 13
set art box to cbox
set p to 14
set theNewString to ((character id 209) & "this is a test" & (character id 211) as text)
#
# values are Text, Font, Font Size, Start Page, End Page, Text type?, Horizontal Alignment, Vertical Offset, Horizontal Offset, Vertical Height, Rotation, Current Page
set p to 15
set theResult1 to my Add_WaterMarkText(theNewString, "Code 128", 48, 1, 1, 1, 0, 3, 10, 0, 0, 1)
do script theResult1
set theResult1 to my Add_WaterMarkText(theNewString, "Code128", 48, 1, 1, 1, 0, 3, 10, 0, 0, 1)
set temp2 to "Text1"
#
# What do I refer the new box as???
set the name of watermark to "Text1"
set temp to do script "this.getField(temp2).textFont"
end tell
display dialog temp
end tell
(*tell application "System Events" to tell process "Adobe Acrobat"
keystroke return
keystroke "a" using command down
set the font of the selection to "Code 128"
end tell*)
end tell
# This handler uses _javascript_
#
on Add_WaterMarkText(cText, cFont, nFontSize, nS, nE, nTA, nHorizontalAlignment, nVerticalAlignment, nHorizontalValue, nVerticalValue, nR, currentPage)
(*set theType to "FreeText" as text
set Params to "cPage:" & currentPage - 1 & ", " & return
set Params to Params & "cType:" & theType & ", " & return
set Params to Params & "cContents:" & cText & ", " & return
set Params to Params & "cTextFont:" & cFont & ", " & return
set Params to Params & "cTextSize:40, " & return
set Params to Params & "cRect:[1, 1, 300, 100], " & return
set Params to Params & "cWidth:0, " & return
set Params to Params & "cAlignment:0, " & return
set _javascript_ to "this.addAnnot({" & Params & "});"*)
set Params to "cTextFont: '" & cFont & "'," & return
set Params to Params & "cText: '" & cText & "'," & return
set Params to Params & "nFontSize: '" & nFontSize & "'," & return
if class of nS is integer then set Params to Params & "nStart: " & (currentPage - 1) & "," & return
if class of nE is integer then set Params to Params & "nEnd: " & (currentPage - 1) & "," & return
-- 0 = left, 1 = centre, 2 = right
if class of nHorizontalAlignment is integer then set Params to Params & "nHorizAlign: " & nHorizontalAlignment & "," & return
-- 3 = top, 4 = bottom
if class of nVerticalAlignment is integer then set Params to Params & "nVertAlign: " & nVerticalAlignment & "," & return
-- offset in points
if class of nHorizontalValue is integer then set Params to Params & "nHorizValue: " & nHorizontalValue & "," & return
-- offset in points
if class of nVerticalValue is integer then set Params to Params & "nVertValue: " & nVerticalValue & "," & return
if class of nR is integer then set Params to Params & "nRotation: " & nR & "," & return
set Params to Params & "bOnScreen: true" & "," & return
set Params to Params & "bOnPrint: true" & "," & return
set Params to Params & "bOnTop: true" & "," & return
set Params to Params & "nOpacity: 1.0" & "," & return
set _javascript_ to "this.addWatermarkFromText({" & Params & "});"
return _javascript_
end Add_WaterMarkText