0
votes

I am working on a vb.net project. I am trying to convert the content of a pdf file to string using acrobat dlls (cannot use other 3 rd party dlls). Below is my code, when I run the program I am getting the following error: "Retrieving the COM class factory for component with CLSID, failed due to the following error: 80040154 Class not registered". I did some research and found out that I have to install the full version of acrobat standard or professional version. Not only that the full version of acrobat must also be installed in all the user machines that the program runs.

Can anyone tell me if this is true and suggest how to fix the class not registered error?

Sub Main()
        Dim s As String
        Dim sSourceFile As String
        sSourceFile = "P:\Report images\DevReports\New Folder\UM-STD-Approval_154.pdf"

        Dim oSourceFileInfo As New System.IO.FileInfo(sSourceFile)

        Dim st As New AcroPDDoc
        st.Open(sSourceFile)
        s = GetText(st)

        Dim oAcroApp As Acrobat.CAcroApp = New Acrobat.AcroApp
        Dim oAcroAvDoc As Acrobat.CAcroAVDoc = New Acrobat.AcroAVDoc
        Dim oAcroPDDoc As Object = Nothing
        If oAcroAvDoc.Open(sSourceFile, "") Then
            'Set PDDoc object and save the file.
            oAcroPDDoc = oAcroAvDoc.GetPDDoc()
            ' oAcroPDDoc.Save(1, sOutputFile)
        Else ' Document FAILED to open.
            MsgBox("Cannot open ")
        End If
        oSourceFileInfo = Nothing
        oAcroApp.CloseAllDocs()
        oAcroPDDoc = Nothing
        oAcroAvDoc = Nothing
        oAcroApp.Exit()
        oAcroApp = Nothing
    End Sub
1
Is this winform or asp.net? - Hanlet Escaño
Its a class library in a windows service project. - user2018949
Try changing your project's platform (in Project's Properties, Build/Platform's Target) to 'X86', and try again. - Hanlet Escaño
The platform is already set to X86 - user2018949
Adobe reader won't work here. you need the full sdk or full Adobe Acrobat version installed. - VahidN

1 Answers

0
votes

Apologies for the obvious answer but you've kind of answered your own question already.

Adobe Reader is a free application with a very limited interface allowing automation; in practice it's limited to the point where you can display a PDF file and navigate through it (to some extent).

For full features automation (like what I think you are looking for) you will need to install the full Adobe Acrobat. And yes, any system you run this on will also need to have Adobe Acrobat installed.

Now, there are probably libraries out there (including libraries from Adobe or containing Adobe technology inside) that will allow you to embed the functionality you are looking for in your application, but those too will not be free...