Coder Social home page Coder Social logo

Not working... about lib-pdf HOT 6 OPEN

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Not working...

from lib-pdf.

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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 [email protected] on 4 Jan 2013 at 8:15

from lib-pdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Same issue....

Original comment by [email protected] on 16 May 2013 at 7:22

from lib-pdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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 [email protected] on 31 May 2013 at 2:24

from lib-pdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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 [email protected] on 31 May 2013 at 2:32

from lib-pdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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 [email protected] on 17 Oct 2013 at 9:05

from lib-pdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
bowlshit, spending time for nothing

Original comment by [email protected] on 12 Jun 2015 at 4:43

from lib-pdf.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.