424,279 Members | 1,905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,279 IT Pros & Developers. It's quick & easy.

programmatically reading .pdf file attributes?

P: n/a
If you right click on a .pdf file, on the "summary" tab there is a property
called "keywords". Is it possible to programmatically read the contents of
the keywords property using VBA?

I want to loop through a bunch of directories looking for pdfs that have
"foobar" in the keywords property.

Thanks,

Paul


Feb 1 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Paul H" <no****@nospam.com> wrote in message
news:hH******************@newsfe6-win.ntli.net...
If you right click on a .pdf file, on the "summary" tab there is a
property called "keywords". Is it possible to programmatically read the
contents of the keywords property using VBA?


You would need to visit Adobe's site, and see what, if any, Application
Programming Interfaces (APIs) the Adobe Acrobat Reader exposes. Access can
interface with many software packages which expose APIs. If they do not,
then you'll need to Google for details on the PDF file format to determine
whether this information is in usable form if you use VBA File I/O to read
the binary information.

Larry Linson
Microsoft Access MVP
Feb 1 '06 #2

P: n/a

"Larry Linson" <bo*****@localhost.not> wrote in message
news:uG7Ef.1832$6d.494@trnddc06...

"Paul H" <no****@nospam.com> wrote in message
news:hH******************@newsfe6-win.ntli.net...
If you right click on a .pdf file, on the "summary" tab there is a
property called "keywords". Is it possible to programmatically read the
contents of the keywords property using VBA?


You would need to visit Adobe's site, and see what, if any, Application
Programming Interfaces (APIs) the Adobe Acrobat Reader exposes. Access can
interface with many software packages which expose APIs. If they do not,
then you'll need to Google for details on the PDF file format to determine
whether this information is in usable form if you use VBA File I/O to read
the binary information.

Larry Linson
Microsoft Access MVP


Many thanks Larry,

I have been trawling the web for hours looking for an answer to this, then
it occurred to me; the "summary" tab is available to a wide variety of file
types (.mdb, .doc, .jpg, .txt). So there must be a common interface to get
at it, it must be something that is already part of the OS, right?

I have been messing about with Scripting.FileSystemObject and not really
getting anywhere. ( I assume that is what you meant)

This is really bugging me now, I've already said "Yea, shouldn't be a
problem" to the client. Gulp!

If you have any more ideas, I'd be very grateful.

Paul
Feb 2 '06 #3

P: n/a

"Paul H" <no****@nospam.com> wrote
I have been trawling the web for hours looking
for an answer to this, then it occurred to me; the
"summary" tab is available to a wide variety of file
types (.mdb, .doc, .jpg, .txt). So there must be a
common interface to get at it, it must be something
that is already part of the OS, right?
Very likely, though I am not familiar with that.
I have been messing about with
Scripting.FileSystemObject and not really
getting anywhere. ( I assume that is what
you meant)
No, that is not what I meant. I don't use the FSO because many System
Administrators uninstall the Scripting Host because of security concerns,
hunt down and eliminate "rogue" programs that try to reinstall it, etc.
Access VBA and classic VB have very nice, very effective File I/O commands
built in. See the Open Statement, Close Statement, Read Statement, Write
Statement, Input # Statement, and Print # Statements. You can read any file
as binary, which may be exactly what you need to get at the information.

This is really bugging me now, I've already
said "Yea, shouldn't be a problem" to the
client. Gulp!

If you have any more ideas, I'd be very grateful.


Visit http://www.mvps.org and find some VB MVP's sites. There was much more
documentation of Windows API use for classic VB (through VB 6.0) than you
will find for Access. Since the same DLL (the most recent is VBA6.DLL, if
memory serves) almost all the API information for VB works for VBA, too.

Larry Linson
Microsoft Access MVP
Feb 2 '06 #4

P: n/a

"Larry Linson" <bo*****@localhost.not> wrote in message
news:Q6rEf.2152$6d.781@trnddc06...

"Paul H" <no****@nospam.com> wrote
I have been trawling the web for hours looking
for an answer to this, then it occurred to me; the
"summary" tab is available to a wide variety of file
types (.mdb, .doc, .jpg, .txt). So there must be a
common interface to get at it, it must be something
that is already part of the OS, right?


Very likely, though I am not familiar with that.
I have been messing about with
Scripting.FileSystemObject and not really
getting anywhere. ( I assume that is what
you meant)


No, that is not what I meant. I don't use the FSO because many System
Administrators uninstall the Scripting Host because of security concerns,
hunt down and eliminate "rogue" programs that try to reinstall it, etc.
Access VBA and classic VB have very nice, very effective File I/O commands
built in. See the Open Statement, Close Statement, Read Statement, Write
Statement, Input # Statement, and Print # Statements. You can read any
file as binary, which may be exactly what you need to get at the
information.

This is really bugging me now, I've already
said "Yea, shouldn't be a problem" to the
client. Gulp!

If you have any more ideas, I'd be very grateful.


Visit http://www.mvps.org and find some VB MVP's sites. There was much
more documentation of Windows API use for classic VB (through VB 6.0) than
you will find for Access. Since the same DLL (the most recent is VBA6.DLL,
if memory serves) almost all the API information for VB works for VBA,
too.

Larry Linson
Microsoft Access MVP


I found it! I stumbled across a VB forum and found the following code. I am
posting here for anyone else who might need it. After a few tweaks I can get
it to do what I want.

Thanks for your time Larry.
**code start****

Public Function SetSummaryInfo()
Dim arrHeaders(41)
Dim objShell, objFolder, i, strFileName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace("C:\test")

For i = 0 To 41
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName In objFolder.Items
For i = 0 To 41
Debug.Print i & vbTab & arrHeaders(i) & ": " &
objFolder.GetDetailsOf(strFileName, i)
Next
Exit For
Next

End Function

**code end****
Feb 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.