maximladus
maximladus

Reputation: 157

How to search in PDF using VBA

Hi I am Rookie in VBA,

Is it possible to search within PDF files using VBA? And return the searched target with the name of the file in which the search is matched?

To give you a better understanding what I do: I have a macro that goes on web page (http://cetatenie.just.ro/ordine/articol-11/) loops through the hyperlinks and downloads the matching criteria files (PDF). Now I need to search within them a name and surname (i.e. BLANARI VITALIE) and know in which file/doc it is published.

The only idea that come into my head is to import data but than again the excel file will get too huge.

Please help!

Upvotes: 0

Views: 20728

Answers (1)

Our Man in Bananas
Our Man in Bananas

Reputation: 5977

if you have Acrobat Professional installed you can use the Automation (Acrobat.AcroPDDoc) and query the Postscript

Here is an example I found for you (by searching on Google):

get the data from PDF file into Excel sheet(s) or text file(s)

to use this code, you need the below References:

  1. AcroPDFLib
  2. Acrobat

on my pc they are in:

  • AcroPDFLib: C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll
  • Acrobat: C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.dll

if you can't find them in your VB Editor References dialog, or by searching for in C:\Program Files\Adobe, then you don't have the necessary components installed on your pc to do it the easy way

The hard way is to strip the PostScript and read it into variables then search the variables!

HTH

Philip

Upvotes: 2

Related Questions