PDF Preview Handler stopped working after upgrading to 64-bit Adobe Reader (COMException E_FAIL)
Hello,
After upgrading Adobe Acrobat Reader DC to the 64-bit version the PDF preview in my .net application isn't working anymore. An exception ist thrown:
- System.Runtime.InteropServices.COMException
- Error message (German): "Beim Aufruf einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben."
- Error code: -2147467259
In Windows Explorer and MS Outlook the PDF preview is shown correctly.
The preview is working in my application when removing the 64-bit version and reinstalling 32-bit Acrobat Reader.
System information:
- Windows 10 20H2
- .net Framework 4.6 application (Platform: Any CPU)
This simplified C# code is embedded in an Winforms windows:
var comType = Type.GetTypeFromCLSID(new Guid("DC6EFB56-9CFA-464D-8880-44885D7DC193"), true);
var comInstance = Activator.CreateInstance(comType);
var iws = comInstance as IInitializeWithStream;
var stream = new COMStream(File.Open(@"C:\test.pdf", FileMode.Open, FileAccess.Read, FileShare.Read));
iws.Initialize(stream, 0);
RECT rect = new RECT {top = 0, bottom = this.Height, left = 0, right = this.Width};
var preview = comInstance as IPreviewHandler;
preview.SetWindow(this.Handle, ref rect);
preview.SetRect(ref rect);
preview.DoPreview();
The COMException is thrown when executing the DoPreview() in the last code line.
I have already tried running the AdobeAcroCleaner_DC2021 tool and reinstalling Acrobat reader. I also checked the registry keys under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{DC6EFB56-9CFA-464D-8880-44885D7DC193} and the corresponding 32-bit keys.
Thank you in advance.
