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 read DLL #4

Closed
bmikkelsen22 opened this issue Jul 28, 2017 · 6 comments
Closed

Unable to read DLL #4

bmikkelsen22 opened this issue Jul 28, 2017 · 6 comments

Comments

@bmikkelsen22
Copy link

bmikkelsen22 commented Jul 28, 2017

I tried making my own project to test this out. I downloaded the 64 bit dll from your link and tried putting it in three different places

  • The root folder (with the .csproj file)
  • The folder with the solution file (One above root folder)
  • The folder with the debug dll in it (bin\Debug\netcoreapp1.1)

I am still getting the same error:
dllnotfound
Is there somewhere else I should be putting the DLL? Thanks!

Edit: Here are the error details:

System.DllNotFoundException occurred
  HResult=0x80131524
  Message=Unable to load DLL 'libwkhtmltox': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
  Source=DinkToPdf
  StackTrace:
   at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics)
   at DinkToPdf.PdfTools.Load() in C:\Users\admin\Documents\DinkToPdf\src\DinkToPdf\PdfTools.cs:line 27
   at DinkToPdf.BasicConverter.Convert(IDocument document) in C:\Users\admin\Documents\DinkToPdf\src\DinkToPdf\BasicConverter.cs:line 42
   at DinkToPdf.SynchronizedConverter.<>n__0(IDocument document)
   at DinkToPdf.SynchronizedConverter.<>c__DisplayClass5_0.<Convert>b__0() in C:\Users\admin\Documents\DinkToPdf\src\DinkToPdf\SynchronizedConverter.cs:line 27
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
@rdvojmoc
Copy link
Owner

Hi, yes it should be in the folder where .csproj is.
Did you try any provided example code?
Can you make repro project to test in on my machine?

@wmeints
Copy link

wmeints commented Jul 29, 2017

Be sure to use the right dll also, I had issues on Windows because I used the x86 version instead of the x64 which is what my system actually required.

@rdvojmoc
Copy link
Owner

In case of wrong version, BadImageFormatException should be thrown.

@bmikkelsen22
Copy link
Author

  • I got your TestConsoleApp to work, but only with the 64 bit library.
  • Your thread safe console app printed this out:
Qt: Could not initialize OLE (error 80010106)
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
  • The test web app added the service, but the controller never got called. I think that was an issue with routing. I tried going to localhost:<port>/api/convert/get, localhost:<port>/api/convert/, localhost:<port>/convert/get, and a few others

Here's a repo with my test project, which I'm still having troubles with. https://github.com/bmikkelsen22/HtmlToPdf

@rdvojmoc
Copy link
Owner

  • If your OS is 64 bit then this is correct behavior. If you want to test with 32 bit library you must run it in 32 bit environment.

  • In thread safe console did you get expected PDF at the end?

  • This is right route to get PDF: http://localhost:5000/api/convert . Tested it again at my end without problems.

  • I added Kestrel server profile to launchSettings.json:

    "Kestrel": {
      "commandName": "Project",
      "launchUrl": "pdf",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:5000"
    }

Select Kestrel profile in VS:
image
In browser go to route http://localhost:5000/pdf. Now you should get expected result.
The reason that I added Kestrel profile is because this library is not compatible with IIS. Problem with IIS is how IIS manage app pools. To resolve that issue Remoting tools should be used but they are not supported in .NET Core.

You see changes that i made to your project here.

@bmikkelsen22
Copy link
Author

Thanks for the quick response! It's working on my machine as well with Kestrel.

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