[英]How to execute the print command in C#
在本文檔的開頭,它說您可以右鍵單擊一個文件並從那里打印。 現在我的問題是,如何使用C#打印? 我可以調用可執行文件,並給它打印命令和文件,然后進行打印。 我可以直接調用該文件,它將打開。 但是,如何調用文件並告訴它打印?
這是我當前的代碼,需要知道程序在哪里。
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = PathToProgram;
psi.Arguments = "/P \"" + PathToFile + "\"";
psi.UseShellExecute = false;
Process.Start(psi).WaitForExit();
好,我知道了。 這正是我想要的。 注意動詞屬性。 它列出了該程序必須使用的不同選項。
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Program.appdata.PathToBillItemsLabels;
//Break. psi.Verbs = { "Open", "Print" };
psi.Verb = "Print";
Process.Start(psi).WaitForExit();
psi.UseShellExecute = true;
您必須將屬性更改為TRUE才能正常工作。 問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.