제공된 파일을 성공적으로 인쇄하는 다음 C # 코드가 있습니다. 이것은 Windows 7에 있습니다.
// Uses the Default settings of the Windows Environment to open the file and send to printer
// Seen: http://stackoverflow.com/a/6106155
public void printPdfHiddenProcess(string filename)
{
ProcessStartInfo info = new ProcessStartInfo();
Process p;
// Set process setting to be hidden
info.Verb = "print";
info.FileName = filename;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
// Start hidden process
p = new Process();
p.StartInfo = info;
p.Start();
// Give the process some time
p.WaitForInputIdle();
Thread.Sleep(1000);
// Close it
if (p.CloseMainWindow() == false)
{
p.Close();
}
}
그러나 이로 인해 기본 프린터로 인쇄됩니다. ProcessStartInfo가 프린터 이름을 전달하는 데 사용할 수있는 특정 메서드를 제공하지 않는 것 같지만 뭔가 누락되었을 수 있습니다.
숨겨진 프로세스를 사용하여 특정 프린터로 인쇄하려면 어떻게합니까?
Print
기본값으로 이동하여 다른 것을 사용 PrintTo
하고 이름을 지정합니다. 저장 및 다른 이름 으로 저장 과 유사
info.Verb = "PrintTo"; // was "Print"
string PrinterName = "Some Printer"; // add printer specific name here...
info.Arguments = PrinterName;
추가 정보 : 문서 인쇄 ... printto 동사 사용
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다