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

Unable to load DLL 'pdfium': The specified module could not be found #33

Closed
Todd1561 opened this issue Nov 15, 2020 · 8 comments
Closed

Comments

@Todd1561
Copy link

I must be doing something stupid, I installed your package via nuget for my ASP.Net application. But when attempting to use docnet I get Unable to load DLL 'pdfium': The specified module could not be found I've tried manually copying the pdfium.dll to the root of the application and set it to always copy to the output directory to ensure it makes it into \bin. But no go. Any ideas?

@Todd1561
Copy link
Author

I was able to fix this by manually copying the 32-bit version of pdfium.dll into c:\windows\syswow64. But it doesn't seem like this should be necessary. I also created a basic console application, added the nuget package as before and ran into the same problem. But I was able to resolve it there just by adding the pdfium.dll to the root of the application. Doing the same for ASP.net web apps doesn't seem to work even though the dll makes it's way into the bin folder as expected.

I can keep using my syswow64 workaround but I'd rather not as I'd need to remember to manually update that file as you adopt new versions of the upstream pdfium into your project.

Any input would be appreciated! Thanks!

@Modest-as
Copy link
Member

Hey, which framework are you targeting?

@Todd1561
Copy link
Author

Todd1561 commented Nov 15, 2020

4.6.1

And thanks for the fine work on this project, it seems to do a great job rendering PDFs. I'm working with large architectural documents that have a lot of layers and markup. Most libraries I've looked into can't handle them, but so far so good here.

EDIT: sorry I initially put the wrong framework version, was looking at the wrong project.

@Modest-as
Copy link
Member

yeah, docnet does not directly support NetFramework, only .net core out of the box so asp.net.core would work. this is because when we pack the nuget we use runtimes folder to copy native binaries which uses System.Runtime.Loader I believe which does not come standard with old .net framework versions. https://stackoverflow.com/questions/52397501/nuget-references-to-assemblies-in-runtimes-folder-not-added . In short .NET Framework does not know how to load the dlls automatically so you might want to do that manually. .NET Framework is an obsolete target so I am reluctant to add a support for it.

@Modest-as
Copy link
Member

I've added an alpha support for never versions of net framework that you can try out with the alpha release

@Todd1561
Copy link
Author

Hey thanks! I'll update my .Net version and try it out.

@Todd1561
Copy link
Author

Todd1561 commented Dec 1, 2020

I finally had a chance to try this out, but I'm still having issues. I've updated my project to the latest .Net 4.8. Should that work with your updates? I see in the release notes you mention 4.7.

@plaisted
Copy link

FYI https://github.com/bblanchon/pdfium-binaries has recently started including pre-built binaries targeting linux-musl-x64. These work fine via p/invoke from .net code from the dotnet alpine docker containers. I don't know if these are compatible with docnet library but could be something to look into if someone really wanted docnet on alpine.

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

3 participants