[英]print order with pdfprint.exe command line tool
I'm using pdfprint.exe ( http://www.verypdf.com/app/pdf-print-cmd/index.html ) in a .NET application. 我在.NET应用程序中使用pdfprint.exe( http://www.verypdf.com/app/pdf-print-cmd/index.html )。 I'm printing several pdf files and several copies of each file in a loop. 我正在循环打印多个pdf文件和每个文件的多个副本。 The code looks like this, this method is called in a loop: 代码看起来像这样,在循环中调用此方法:
private bool PrintFile(string file, string printer, short copies)
{
try
{
this.log.Debug("Send command to verypdf...");
var info = new ProcessStartInfo
{
FileName = this.veryPdfExe,
Arguments = string.Format(@"-printer ""{0}"" -printermargins -mergeprintjobs -copies {1} ""{2}""", printer, copies, file),
CreateNoWindow = true
};
this.log.Debug(info.Arguments);
var process = new Process { StartInfo = info };
process.Start();
return true;
}
catch (Exception ex)
{
this.log.Error(ex);
throw new LabelMakerException("Failed to print file: " + file);
}
}
My problem is that the files are not printed in the same order as they were sent to the printer. 我的问题是文件的打印顺序与发送到打印机的顺序不同。 Is there a way to control this. 有没有办法控制这一点。 I have not found any command line arguments. 我没有找到任何命令行参数。 Is there a way to configure a printer to be synchronous? 有没有一种方法可以将打印机配置为同步? All ideas and tips are appreciated. 所有的想法和技巧表示赞赏。
Try calling Process.WaitForExit after started it. 启动后尝试调用Process.WaitForExit 。
If it doesn't work (verypdf shut itself down before the printer start printing), use a Thread.Sleep command after starting the process. 如果它不起作用(在打印机开始打印之前,verypdf会自行关闭),请在启动该过程后使用Thread.Sleep命令。 Try setting dinamically the timeout according to different situations (ie number of copies, first use of printer, size of file). 尝试根据不同情况(例如,份数,首次使用打印机,文件大小)动态设置超时时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.