Giter Site home page Giter Site logo

Comments (3)

foxlovei avatar foxlovei commented on May 29, 2024

how about this
#119

from dinktopdf.

thanhy123zzz avatar thanhy123zzz commented on May 29, 2024

public void ConfigureServices(IServiceCollection services)
{
// Add converter to DI
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
}
i think, this is your issues

from dinktopdf.

yozawiratama avatar yozawiratama commented on May 29, 2024

I'm having the same issue, has anyone solved this problem?

I already add this code

builder.Services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

and also I already add load library manually

string libraryPath = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
    // Load .dll for Windows
    libraryPath = "libwkhtmltox.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
    // Load .so for Linux
    libraryPath = "libwkhtmltox.so";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
    // Load .dylib for macOS
    libraryPath = "libwkhtmltox.sylib";
}

var loadContext = new CustomAssemblyLoadContext();
var fullpath = Path.Combine(Directory.GetCurrentDirectory(), libraryPath);
IntPtr libraryHandle = loadContext.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), libraryPath));
// Pastikan library berhasil dimuat
if (libraryHandle == IntPtr.Zero)
{
    Console.WriteLine("Failed to load the library.");
    return;
}

Console.WriteLine("Library loaded successfully.");


var builder = WebApplication.CreateBuilder(args);

but the problem still same, the second request response properly, I suspect libwkhtmltox is still stuck in the process, as we know we use external library here, and it do not managed properly by dotnet core.

So is there anyone already solve this problem?

btw I user docker linux here

from dinktopdf.

Related Issues (20)

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.