Gordon_Atherley
asked on
How to use VB6 to get the title of a pdf document?
I use VB6 with XP OS. I want to access the Title property of pdf files without user input at runtime. I've tried the file object in FSO, but that doesn't exhibit the Title property I am looking for.
Any suggestions, please?
I found the very question in EE but the answer is deleted!
Gordon A
Any suggestions, please?
I found the very question in EE but the answer is deleted!
Gordon A
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Problem: I can't get this to work in a distributed run time version of my app. Does Adobe Acrobat 5.0 Type Library require the full Acrobat, not just the reader, to be installed on the distributed-to machine? Or does the distributed-to machine need version 5 of the reader, or anything along these lines, please?
hi !!
i'm not sure exactly whether the reader will suffice, or whether the full acrobat is required. maybe there might also be a problem if the user has acrobat 4, and u have compiled your program using acrobat 5.
maybe, what u could do is, distribute the dll along with your program, and copy it in the same folder as your exe, and then do "regsvr32" (from within the vb code) to register the dll .. ?
muskad202
i'm not sure exactly whether the reader will suffice, or whether the full acrobat is required. maybe there might also be a problem if the user has acrobat 4, and u have compiled your program using acrobat 5.
maybe, what u could do is, distribute the dll along with your program, and copy it in the same folder as your exe, and then do "regsvr32" (from within the vb code) to register the dll .. ?
muskad202
one thing u might try (incase the thing is not working becoz of wrong versions of acrobat)
remove the reference to the adobe type library
then, change the code as follows
-------------------------- ---------- ---------
Dim x As String
x = InputBox("Enter complete path to PDF File")
Dim opdf As Object
Set opdf = CreateObject("AcroExch.PDD oc")
opdf.Open (x)
Dim y As String
y = opdf.GetInfo("Title")
MsgBox y
Set opdf = Nothing
--------------
remove the reference to the adobe type library
then, change the code as follows
--------------------------
Dim x As String
x = InputBox("Enter complete path to PDF File")
Dim opdf As Object
Set opdf = CreateObject("AcroExch.PDD
opdf.Open (x)
Dim y As String
y = opdf.GetInfo("Title")
MsgBox y
Set opdf = Nothing
--------------
ASKER
Thanks
I've tried the verision dim opdf as Object.
It runs in the development machine, which has Acrobat 5 installed. But it runs on neither of the test machines, Reader 4 /W2K, and Reader 6/XP installed.
I'll now try distributing the Acrobat dll, with registration.
Gordon A
I've tried the verision dim opdf as Object.
It runs in the development machine, which has Acrobat 5 installed. But it runs on neither of the test machines, Reader 4 /W2K, and Reader 6/XP installed.
I'll now try distributing the Acrobat dll, with registration.
Gordon A
ASKER
Muskad202's code works nicely with Acrobat 6.0 Pro
Dim oPdf As Object
Set oPdf = CreateObject("AcroExch.PDD oc")
oPdf.Open (sFileAndPathOld_)
sFileTitle = oPdf.GetInfo("Title")
sPDFAuthor = oPdf.GetInfo("Author")
Title and Author, along with Subject and Keywords are set by the user who creates the PDF document.
But the following returns nothing, whether as string, date, or variant type
sPDFCreated = oPdf.GetInfo("Created")
Created, a date, is not accessible to the user-creator, so I presume that's why oPdf.GetInfo can't read it or the Modified date.
Any suggestions for reading the Created and Modified fields please?
Gordon A
Dim oPdf As Object
Set oPdf = CreateObject("AcroExch.PDD
oPdf.Open (sFileAndPathOld_)
sFileTitle = oPdf.GetInfo("Title")
sPDFAuthor = oPdf.GetInfo("Author")
Title and Author, along with Subject and Keywords are set by the user who creates the PDF document.
But the following returns nothing, whether as string, date, or variant type
sPDFCreated = oPdf.GetInfo("Created")
Created, a date, is not accessible to the user-creator, so I presume that's why oPdf.GetInfo can't read it or the Modified date.
Any suggestions for reading the Created and Modified fields please?
Gordon A
Try using the following:
sPDFCreated = oPdf.GetInfo("CreationDate ")
sPDFModified = oPdf.GetInfo("ModDate")
sPDFCreated = oPdf.GetInfo("CreationDate
sPDFModified = oPdf.GetInfo("ModDate")
ASKER
jrudyk
Here's what I get:
Modified D:20030807114545-04'00'
Created D:20030718104306Z00'00'
... which is exactly what I needed!
Thank you, appreciated
Gordon A
Here's what I get:
Modified D:20030807114545-04'00'
Created D:20030718104306Z00'00'
... which is exactly what I needed!
Thank you, appreciated
Gordon A
ASKER
Gordon A