LoadIFilter () returns -2147467259 for some PDF files

I am trying to use Adobe IFilter to search for PDF files. My code is written in C # and I use p / invoke to get an IFilter instance:

[DllImport("query.dll", SetLastError = true, CharSet = CharSet.Unicode)] private extern static int LoadIFilter( string pwcsPath, [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, ref IFilter ppIUnk); 

This works for most PDFs, with the exception of a few for which this method returns -2147467259 and ppIUnk returns null. Does anyone have such errors or any suggestions on how to figure this out?

+4
source share
4 answers

See the MSDN docs for the LoadIFilter function - you should get one of the error codes, at least according to this page.

  • E_ACCESSDENIED = 0x80070005 - The function was denied access to the filter file.
  • E_HANDLE = 0x80070006 - The function detected an invalid handle, probably due to a low memory situation.
  • E_INVALIDARG = 0x80070057 - The function received an invalid parameter.
  • E_OUTOFMEMORY = 0x8007000E - The function did not have enough memory or other resources to complete the operation.
  • E_FAIL = 0x80000008 - The function detected an unknown error.

(In addition, the full set of constant values ​​is listed here , which seems to be longer than indicated on MSDN.) Now, the interesting thing is that your error code corresponds to 80004005 in hexadecimal format, which is not indicated on any page. I suspect that pinvoke.net could be wrong, like many other sites ( this , for example), list it as E_FAIL .. not that it really helps anyway. Sorry for the unconvincing answer, but maybe it will show you the right way at least.

Edit: This error seems to have been reported elsewhere and caused a lot of confusion for many people without a simple solution. It seems that the reason may be one of several actually ... There are various suggestions here and here that you can try, but I don’t think I can help you more than that, since I never encountered this error in This context. Anyway, good luck ...

+4
source

Here's how I solved it:

Uninstall Adobe Reader / Acrobat. Install the latest version (again). It should fix the PDF filters. Good luck.

0
source

To get around E_FAIL for Adobe 10.x, see fooobar.com/questions/895768 / ...

0
source

I got the same result when starting LoadIFilter until I found this post that pointed me to a solution:

Make sure the target platform is the x86 platform and do not run the application from Visual Studio.

In addition, if you can move the code that interacts with IFilter to a separate .exe application called filtdump.exe, you will greatly simplify your code.

0
source

Source: https://habr.com/ru/post/895769/


All Articles