问题
I'm trying to open a PDF document inside a C# application using Acrobat Inter Application Communication (IAC) in a Visual C# 2008 Express Edition project.
When executing the following code I get an exception:
CAcroPDDoc pdDoc = new AcroPDDocClass();
The exception reports that the COM class factory for a particular CLSID has failed with error 80040154. Looking up the error code in winerror.h on MSDN the error is related to the class not being registered.
I tried using regsvr32 to register the Interop.Acrobat.dll but this fails to work (can't find entry-point DllRegisterServer).
I have tried the example C# project that comes with the Acrobat 9 SDK (BasicIacCS - there's a visual studio project called BasicIacCS.suo, this imports into c# Express without any errors but fails with the same exception).
Am I making some fundamental mistake? (I'm new to Windows/.NET programming)
Is this possible under the express edition or should I upgrade to Visual Studio?
Looking further into the problem the CLSID that is being complained about is available when I do an ILDASM of my application (.exe file) - it's the CLSID of the AcroPDDoc class I'm trying to access. This class and it's associated CLSID is absent from the registry. I only have Acrobat reader installed - not the full version. Is the full version of Acrobat required to access COM interfaces? (I only have Acrord32.dll, not Acrobat.dll present on the system). I've tried out the same program on a different Vista machine and have uninstalled/reinstalled Arobat reader with the same result.
回答1:
The problem is probably in the main Acrobat dll not being registered, not the interop dll.
Try reinstalling Acrobat, or registering the acrobat DLLs.
来源:https://stackoverflow.com/questions/2063111/visual-c-sharp-express-edition-cant-get-acrobat-pdf-reader-to-work