ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   search within PDF... (https://www.excelbanter.com/excel-programming/348338-search-within-pdf.html)

tom

search within PDF...
 
Using VBA, I made it possible to open certain PDF files that are related to
the cell. Problem is, It opens several PDF files. Is there a way to open just
the one that contains a certain string? I haven't been able to figure out how
to perform a search within a pdf. Any help would be greatful.
Thank you in advanced,
tom

tom

search within PDF...
 
I meant a certain string within the PDF files.
Thank you


"tom" wrote:

Using VBA, I made it possible to open certain PDF files that are related to
the cell. Problem is, It opens several PDF files. Is there a way to open just
the one that contains a certain string? I haven't been able to figure out how
to perform a search within a pdf. Any help would be greatful.
Thank you in advanced,
tom


Eric White[_2_]

search within PDF...
 
First, It depends on how the PDF was created. If it was created from an
electronic source (e.g., a Word file), the text is searchable; if it was
scanned to PDF, what you're actually seeing is a "picture" of the text in the
PDF and, thus, you can't search that.

Secondly, if you have Adobe Acrobat (creator) installed, you can hook into
Acrobat's javascript object model with VBA. You'll need to set a reference
to the Acrobat 6.0 (or what-have-you) Type Library. For example:

Dim gAPP As Acrobat.CAcroApp 'PDF app
Dim gPDDoc As Acrobat.CAcroPDDoc 'Default document in PDF
Dim jso As Object 'javascript object
Dim bkmkRoot As Object 'PDF doc root bookmark

Set gAPP = CreateObject("AcroExch.App") 'Get Acrobat application
Set gPDDoc = CreateObject("AcroExch.PDDoc") 'Get document
Set jso = gPDDoc.GetJSObject
Set bkmkRoot = jso.bookmarkRoot

(Note: Everything following the "jso." should be javascript, using
javascript conventions.)

You can download the Acrobat javascript object model reference from Adobe.
(I can't recall the website where I picked up how to link VBA and javascript.)


"tom" wrote:

I meant a certain string within the PDF files.
Thank you


"tom" wrote:

Using VBA, I made it possible to open certain PDF files that are related to
the cell. Problem is, It opens several PDF files. Is there a way to open just
the one that contains a certain string? I haven't been able to figure out how
to perform a search within a pdf. Any help would be greatful.
Thank you in advanced,
tom


tom

search within PDF...
 
everything is done in javascript in Acrobat? I know how to script in
Javascript some what. I'll go on ahead and look into that. I found an article
on Acrobat's web-site explaining how to link Javascript and VB. I figure the
steps to link VB and the steps to link VBA are the same. Thanks for the step
in the right direction, Eric.
tom

"Eric White" wrote:

First, It depends on how the PDF was created. If it was created from an
electronic source (e.g., a Word file), the text is searchable; if it was
scanned to PDF, what you're actually seeing is a "picture" of the text in the
PDF and, thus, you can't search that.

Secondly, if you have Adobe Acrobat (creator) installed, you can hook into
Acrobat's javascript object model with VBA. You'll need to set a reference
to the Acrobat 6.0 (or what-have-you) Type Library. For example:

Dim gAPP As Acrobat.CAcroApp 'PDF app
Dim gPDDoc As Acrobat.CAcroPDDoc 'Default document in PDF
Dim jso As Object 'javascript object
Dim bkmkRoot As Object 'PDF doc root bookmark

Set gAPP = CreateObject("AcroExch.App") 'Get Acrobat application
Set gPDDoc = CreateObject("AcroExch.PDDoc") 'Get document
Set jso = gPDDoc.GetJSObject
Set bkmkRoot = jso.bookmarkRoot

(Note: Everything following the "jso." should be javascript, using
javascript conventions.)

You can download the Acrobat javascript object model reference from Adobe.
(I can't recall the website where I picked up how to link VBA and javascript.)


"tom" wrote:

I meant a certain string within the PDF files.
Thank you


"tom" wrote:

Using VBA, I made it possible to open certain PDF files that are related to
the cell. Problem is, It opens several PDF files. Is there a way to open just
the one that contains a certain string? I haven't been able to figure out how
to perform a search within a pdf. Any help would be greatful.
Thank you in advanced,
tom



All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com