Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-03-27
6
Medium Priority
?
618 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 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