您的位置:首页 > 其它

how to automate label printing with command line parameters

2010-12-14 15:24 507 查看
/// <summary>
/// Print label using Command line
/// </summary>
/// <param name="btwFilePath">btwFilePath</param>
public void BarTenderCommandLinePrintLabel(string btwFilePath)
{
Process p = new Process();
p.StartInfo.FileName = bartenderPath;//bartender.exe path
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = " /F=" + '"' + btwFilePath + '"' + " /P/X";
//p.StartInfo.Arguments = " /F=" + '"' + btwFilePath + '"' + " /D=" + '"' + dataFilePath + '"' + " /P/X";
//./P  Executes a print job, leaving the status of the Use Database check box of the Print dialog unchanged
//./F  Specifies a label format to load.
//./D="<path to data file>"
//./X  Specifies that, after all requested functions have been performed, BarTender will automatically exit,
//     but without saving any changes that may have occurred as a result of any command line actions
//     that were performed or data values that were incremented.

p.Start();
p.WaitForExit(30000);
p.StandardOutput.Close();
p.Close();
p.Dispose();
Thread.Sleep(1000);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息