美文网首页
.net core中引入fastreport.open在linu

.net core中引入fastreport.open在linu

作者: 小冕 | 来源:发表于2019-01-21 12:29 被阅读0次

    在linux端添加xServer应用;
    然后,在web下面添加依赖项:runtime.linux-x64.CoreCompat.System.Drawing
    在startup.cs中,添加如下命令:

           static Process xvfb;
            const string xvfb_pid = "pid.xvfb.fr";
            public Startup(IConfiguration configuration)
            {
                LinuxStart();
           
            }
           public static void LinuxStart()
            {
                if (File.Exists(xvfb_pid))
                {
                    string pid = File.ReadAllText(xvfb_pid);
                    try
                    {
                        xvfb = Process.GetProcessById(int.Parse(pid));
                        xvfb.Kill();
                        xvfb = null;
                    }
                    catch { }
                    File.Delete(xvfb_pid);
                }
                //string display = Environment.GetEnvironmentVariable("DISPLAY");
                //if (String.IsNullOrEmpty(display))
                //{
                //    Environment.SetEnvironmentVariable("DISPLAY", ":99");
                //    display = ":99";
                //}
                ProcessStartInfo info = new ProcessStartInfo();
                info.FileName = "/usr/bin/Xvfb";
                info.Arguments = ":99 -ac -screen 0 1024x768x32 +extension RANDR -dpi 96";
                info.CreateNoWindow = true;
                xvfb = new Process();
                xvfb.StartInfo = info;
                xvfb.Start();
                // File.WriteAllText(xvfb_pid, xvfb.Id.ToString());
            }
    
    

    相关文章

      网友评论

          本文标题:.net core中引入fastreport.open在linu

          本文链接:https://www.haomeiwen.com/subject/bxqcjqtx.html