Solved

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

Posted on 2004-03-27
6
610 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

739 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