Solved

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

Posted on 2004-03-27
6
613 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
Suggested Courses
Course of the Month7 days, 13 hours left to enroll

632 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