OpenFile throws 'System.DllNotFoundException'
mgnslndh opened this issue · 5 comments
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
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
.
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 ?
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.
@NessfertIndia follow instructions by reliak and it should work.
i encountered the same question, and this cannot solve it