These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

removing text

lucaso
Registered: Feb 5 2008
Posts: 49

can plain text be removed with JavaScript? One can remove fields, icons etc,
but I can't figure out how to remove/delete plain text. In IAC there's mention of 'destroy', I've tried it on text, doesn't seem to do anything:

gpAvText = gPdDoc.CreateTextSelect(i, Rect)
numtxt = gpAvText.GetNumText
For ii As Integer = 0 To numtxt - 1
If gpAvText.GetText(ii) = "Acrobat" Then
MsgBox("found")
gpAvHilite.Add(ii, 7)
End If
Next

gpAvText2 = gPDPage.CreateWordHilite(gpAvHilite)
gAvDoc.ShowTextSelect()
MsgBox(gpAvText2.GetText(0)) //make sure it's the right text
res = gpAvText2.Destroy() //res turns out to be -1, means succes

Any suggestions?

although pushing towards senior age, still want to keep up the pace

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Text, graphics, and images on a PDF page are called page content. You cannot delete page content from either the JavaScript or the IAC.

Form feilds and comment annotations are separate interactive elements that float above the content. JavaScript was written specifically for handling the interactive elements.

However, you can use the IAC and JavaScript to add content to a page. For example, you could place a solid white box (a form field or square annotation) over some text and then flatten it, to make it look like the text has been deleted. This is as good as it gets.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lucaso
Registered: Feb 5 2008
Posts: 49
hi, thomp,
but i can change content in Acrobat. another option would be then to use a execMenu. there is a 'touchup object', which does the trick. i do understand there is a difference between an object holding 'content' and the 'content' itself. this specific menuItem, i have not found yet, or is this prog-impossible?

although pushing towards senior age, still want to keep up the pace