Beispiel #1
0
        public PdfExporter()
        {
            CustomAssemblyLoadContext context = new CustomAssemblyLoadContext();

            // Check the platform and load the appropriate Library
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                var wkHtmlToPdfPath = Path.Combine(Directory.GetCurrentDirectory(), $"runtimes\\linux-x64\\native\\wkhtmltox.so");
                if (!File.Exists(wkHtmlToPdfPath))
                {
                    wkHtmlToPdfPath = Path.Combine(Directory.GetCurrentDirectory(), $"wkhtmltox.so");
                }
                context.LoadUnmanagedLibrary(wkHtmlToPdfPath);
            }
        }
        public PdfExporter()
        {
            CustomAssemblyLoadContext context = new CustomAssemblyLoadContext();

            // Check the platform and load the appropriate Library
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                var appPath         = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                var wkHtmlToPdfPath = Path.Combine(appPath, "runtimes", "linux-x64", "native", "wkhtmltox.so");
                if (!File.Exists(wkHtmlToPdfPath))
                {
                    wkHtmlToPdfPath = Path.Combine(appPath, $"wkhtmltox.so");
                }

                context.LoadUnmanagedLibrary(wkHtmlToPdfPath);
            }
        }