Solved

Reading PDF metadata: problems with PDFVersion(Acrobat 3x), any workarounds with VB6?

Posted on 2004-03-27
6
583 Views
Last Modified: 2008-03-10
When Acrobat Pro 6 is installed, the following VB 6 code works well
 
        Dim oPDF As Object
        Set oPDF = CreateObject("AcroExch.PDDoc")
        oPDF.Open (PathtoMyfile)        
        sFileTitle = oPDF.GetInfo("Title")

However, when this code encounters a PDF file with PDFVersion(Acrobat3.x) it hangs and eventually crashes.

Please can an expert suggest a workaround, such as a trap to detect the version before the hang/crash, or better yet, of course, a way to read the metadata of the legacy version?

Gordon
0
Comment
Question by:Gordon_Atherley
  • 4
6 Comments
 

Author Comment

by:Gordon_Atherley
ID: 10700952
I'm encountering more and more pdfs that are five or more years old, so the problem of the version of Acrobat used to create them is getting quite urgent. I've increased the points accordingly.

Suggestions will be gratefully received

Gordon
0
 

Author Comment

by:Gordon_Atherley
ID: 10709896
I'm narrowing down the problem, which may help explain my question better.
On a machine with Acrobat Professional I can read the title of a pdf using this code

        Dim oPDF As Object
        Set oPDF = CreateObject("AcroExch.PDDoc")
        oPDF.Open (PathtoMyfile)        
        sFileTitle = oPDF.GetInfo("Title")

What should I subtitue for "Title" in GetInfo to read the PDF version?
In the dcoument properties (accessed from File > Properties), for a problem PDF, typically the data is

         PDF Version: 1.2(Acrobat 3.x)

I've tried various abbreviations of "PDF Version" without succes. Help would be really appreciated, please

Gordon
0
 

Accepted Solution

by:
Gordon_Atherley earned 0 total points
ID: 10933905
I developed an answer of sorts to my question. I'm posting it here in case it's useful to someone. I can't very well accept my own answer and get points for doing it <grin> so, page editor, please could you close the question.

PDFs don't appear to have clearly defined version types. Instead, it seems, you have to go by the name of the application that produced the particular PDF, which is found in the Producer field. Then you look for words to identify the version of the application, which gives useful information about the PDF. Here's my so-so solution to ensure that I'm dealing with a PDF created by Adobe versions 5 and six.

        Dim oPDF As Object
        Set oPDF = CreateObject("AcroExch.PDDoc")
        oPDF.Open (myFileAndPath)
       
        sPDFProducer = oPDF.GetInfo("Producer")
       
        If InStr(sPDFProducer, "Adobe") > 0 Then
            If InStr(sPDFProducer, "5.") > 0 Then
                bProcess = True
            ElseIf InStr(sPDFProducer, "6.") > 0 Then
                bProcess = True
            End If
        ElseIf InStr(sPDFProducer, "Acrobat") > 0 Then
            If InStr(sPDFProducer, "5.") > 0 Then
                bProcess = True
            ElseIf InStr(sPDFProducer, "6.") > 0 Then
                bProcess = True
            End If
        End If
       
0
 

Author Comment

by:Gordon_Atherley
ID: 11260101
Moderator

I answered my own question, so may I please leave it to you to decide the outcome?

Gordon
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now