PDA

View Full Version : [HELP!!!] ABOUT PDF FILE



kidsing
01-05-2005, 09:30 PM
:) Hi,
want to know how to use VBA to control a PDF file, for example, to find a word in PDF and highlight it in yellow.:dunno

thanks very much!!!!

Killian
01-12-2005, 10:19 AM
You'll need to add the Acrobat Type Library in Tools|References, then you will have access to some of the Acrobat object model.
As an example, I tested this with the following code run from Excel.
Hopefully, this will get you started:
Sub FindTextInPDF()
Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Dim PDDoc As CAcroPDDoc
Dim myPath As String
Dim myString As String

'you'll need to change this to an existing pdf file on your system
myPath = "N:\Andy\connexions\re-view-02-04-04.pdf"

Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")

AVDoc.Open myPath, ""
Set PDDoc = AVDoc.GetPDDoc

myString = InputBox("Enter text to search for:", "PDF Search")
AVDoc.FindText myString, 0, 0, 0
AcroApp.Show

End Sub

Have fun!

kidsing
01-12-2005, 10:17 PM
Sure, this could be good start for me!
Thank you, Killian!:hi:

kidsing
01-12-2005, 10:27 PM
Hi Killian,:mkay
There is no help information showing out when I press F1 in the VBA editor. It got me headache cause I am not familar with Acrobat objects' properties, methods and events. Could you tell me where I can access these information?

Blessing:p
Kidsing

Killian
01-13-2005, 04:21 AM
No, there won't be a help file associated with the Acrobat stuff, however you can get useful info from the object browser (hit F2 for this). Do a search for "Acro" and then browse through the Acrobat objects. The details for the selected object are shown at the bottom of this screen so you can see what each thing does and it's arguments.

For more details and questions, I've used the forum archive here:
http://www.planetpdf.com/
You might also want to Google around to see what else turns up

Good luck