I have a script to read words in a PDF, but I need to edit one. These are not in fields like typical PDFs might have. Any idea on how to do that?
This was my attempt. Here is a document for references https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/5186AcroJS.pdf
Code: Select all
#SingleInstance, Force
source:=A_Desktop . "\1.pdf"
PDDoc := ComObjCreate("AcroExch.PDDoc")
PDDoc.Open(source)
JSO := PDDoc.GetJSObject
w=0
Loop 1000
{
Word := JSO.GetPageNthWord(0, w, 0)
If (InStr(Word,"Plate"))
{
w--
Word := JSO.GetPageNthWord(0, w, 0)
msgbox, % "Before: " . Word
JSO.SelectPageNthWord(0, w, 0).Value := "Bowl" ;didn't work.
PDDoc.Save(1,source)
Word := JSO.GetPageNthWord(0, w, 0)
msgbox, % "After: " . Word
exitapp
}
W++
}
exitapp
Thanks,
Vh