Open GoogleCodeExporter opened 9 years ago
No matter what I do....
Could not load file or assembly 'libpdf.dll' or one of its dependencies. The
specified module could not be found
Original comment by bill.bor...@gmail.com
on 4 Jan 2013 at 8:15
Same issue....
Original comment by csnv...@gmail.com
on 16 May 2013 at 7:22
Hi Folks,
Depending on how/where you're using this you *may* need to load the library
manually. I've found this was necessary when using it in an ASP.NET project.
Apparently it is a bit of a bug in how the .NET runtime handles mixed c++ dlls..
// Add this code somewhere BEFORE you use the libpdf code
// Adds a handler to the AssemblyResolve event to manually load the libpdf
library when the CLR fails to find it
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(currentDomain_AssemblyResolve);
// Put this function somewhere else in you're code.. Remember to change the 'Path to libPDF' bit below!!
// Resolve assemblies the CLR can't find/load
Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.StartsWith("libpdf"))
{
string libPDFPath = <PATH to libPDF>
if (File.Exists(libPDFPath))
{
try
{
ProxyDomain pd = new ProxyDomain();
return pd.LoadAssembly(libPDFPath);
}
catch (Exception ex)
{
throw new Exception("Could not load libPDF: " + libPDFPath, ex);
}
}
else throw new FileNotFoundException("Could not find libPDF: " + libPDFPath);
}
else return null;
}
HTH
Andrew
Original comment by a.bromw...@gmail.com
on 31 May 2013 at 2:24
Oops.. forgot definition of ProxyDomain class. Here it is (from
http://stackoverflow.com/questions/658498/how-to-load-assembly-to-appdomain-with
-all-references-recursively):
using System;
using System.Reflection;
/// <summary>
/// Summary description for ProxyDomain
/// </summary>
public class ProxyDomain : MarshalByRefObject
{
public Assembly LoadAssembly(string AssemblyPath)
{
try
{
return Assembly.LoadFrom(AssemblyPath);
}
catch (Exception ex)
{
throw new InvalidOperationException("Failed to load assembly", ex);
}
}
}
Original comment by a.bromw...@gmail.com
on 31 May 2013 at 2:32
This fix does not work, I still get the same error.
It appears that the zip file may be missing .dlls that are dependencies.
Original comment by worleb...@gmail.com
on 17 Oct 2013 at 9:05
bowlshit, spending time for nothing
Original comment by rafaelho...@gmail.com
on 12 Jun 2015 at 4:43
Original issue reported on code.google.com by
vitalyta...@gmail.com
on 29 Mar 2012 at 11:57