Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Suggested Courses

773 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