Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenFile throws 'System.DllNotFoundException' #11

Open
mgnslndh opened this issue Feb 7, 2016 · 5 comments
Open

OpenFile throws 'System.DllNotFoundException' #11

mgnslndh opened this issue Feb 7, 2016 · 5 comments

Comments

@mgnslndh
Copy link

mgnslndh commented Feb 7, 2016

I call OpenFile on the MoonPdfPanel and get the following exception:

An exception of type 'System.DllNotFoundException' occurred in MoonPdfLib.dll but was not handled in user code

Message

Det gick inte att läsa in DLL-filen libmupdf.dll: Det går inte att hitta den angivna modulen. (Undantag från HRESULT: 0x8007007E)

Stack Trace

   vid MoonPdfLib.MuPdf.MuPdfWrapper.NativeMethods.NewContext(IntPtr alloc, IntPtr locks, UInt32 max_store)
   vid MoonPdfLib.MuPdf.MuPdfWrapper.PdfFileStream..ctor(IPdfSource source)
   vid MoonPdfLib.MuPdf.MuPdfWrapper.GetPageBounds(IPdfSource source, ImageRotation rotation, String password)
   vid MoonPdfLib.MoonPdfPanel.LoadPdf(IPdfSource source, String password)
   vid MoonPdfLib.MoonPdfPanel.Open(IPdfSource source, String password)
   vid MoonPdfLib.MoonPdfPanel.OpenFile(String pdfFilename, String password)

I am using Nuget package version 0.3.0

@reliak
Copy link
Owner

reliak commented Feb 7, 2016

Hi,

the problem is that the native libmupdf.dll is not in the executing directory.
The NuGet package you are mentioning is not from me, but as far as I can tell, there is no automatism to copy the libmupdf.dll to the output directory.
You can find the libmupdf.dll in the lib-folder of the NuGet package, which should be: packages\MoonPdfLib-x86.0.3.0\lib. Include the dll in your project and set its property Copy to Output Directory to Copy Always.

@NessfertIndia
Copy link

I tried to add dll from the packages folder and i am getting the message or warning from Visual studio

A reference to dll from the package folder could not be added
make sure file is accessible and that is a valid assembly or com component

Have you faced the same issue @mgnslndh ?

@reliak
Copy link
Owner

reliak commented Mar 10, 2016

You can not add the dll in VS because it is a native c-dll. The solution is, as stated above, to use Copy to Output to copy the dll to the executing directory.

@mgnslndh
Copy link
Author

@NessfertIndia follow instructions by reliak and it should work.

@lannisite110
Copy link

i encountered the same question, and this cannot solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants