首页 新闻 会员 周边 捐助

C# web程序关于使用wkhtmltopdf插件无法写入目标文件

0
悬赏园豆:20 [已解决问题] 解决于 2020-10-16 21:26

try
{
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = exePath;
processStartInfo.WorkingDirectory = Path.GetDirectoryName(exePath);
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;
processStartInfo.RedirectStandardInput = true;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.RedirectStandardError = true;
processStartInfo.Arguments = GetArguments(htmlPath, savePath);

            Process process = new Process();
            process.StartInfo = processStartInfo;
            process.Start();
            process.WaitForExit();
            string fileName = Path.GetFileName(savePath);


            ///用于查看是否返回错误信息
            StreamReader srone = process.StandardError;
            StreamReader srtwo = process.StandardOutput;
            string ss1 = srone.ReadToEnd();
            string ss2 = srtwo.ReadToEnd();
            srone.Close();
            srone.Dispose();
            srtwo.Close();
            srtwo.Dispose();

            process.Close();
            process.Dispose();

            flag = true;
        }
        catch(Exception ex)
        {
            flag = false;
            throw new Exception(ex.ToString());
        }
buzhishei的主页 buzhishei | 初学一级 | 园豆:163
提问于:2019-09-08 10:47
< >
分享
最佳答案
-1
收获园豆:20
E-iceblue | 菜鸟二级 |园豆:431 | 2019-09-09 10:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册