【发布时间】:2018-11-15 16:39:46
【问题描述】:
我认为我做错了什么,或者这是不可能的。我可以从命令提示符运行并使用下面代码中的路径创建 pdf。有关更多信息,我使用命令行时的参数字符串如下所示: chrome --headless --print-to-pdf="c:\Users\pwtph82\desktop\myreport\myreport.pdf" https://google.com
提前感谢您的帮助。
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.StartInfo.FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
string arguments = @"chrome --headless --print-to-pdf=""c:\\Users\pwtph82\desktop\myreport\myReport.pdf"" https://google.com";
process.StartInfo.Arguments = "/C " + arguments;
process.Start();
【问题讨论】:
-
process.StartInfo.Arguments = "/C " + arguments;是做什么的?为什么chrome包含在参数中?
标签: c# html pdf command-line-arguments