[英]Configure Virtual Printer Port Redirection
我找到了解決上述問題的方法。 在系統上注冊的所有打印機端口都在“ SYSTEM \\ ControlSet001 \\ Control \\ Print \\ Monitors \\ Redirected Port \\ Ports ”鍵下的注冊表中列出
可以編輯這些鍵下的值以獲得所需的結果。 下面是使用c#編輯它的代碼。
bool found = false;
string portName = "testing:";
RegistryKey PrinterPort = Registry.LocalMachine.OpenSubKey("SYSTEM\\ControlSet001\\Control\\Print\\Monitors\\Redirected Port\\Ports", true);
foreach (string pp in PrinterPort.GetSubKeyNames())
{
if (pp == portName)
{
PrinterPort = Registry.LocalMachine.OpenSubKey("SYSTEM\\ControlSet001\\Control\\Print\\Monitors\\Redirected Port\\Ports"+"\\"+portName, true);
found = true; break;
}
}
if (found)
{
PrinterPort.SetValue(@"Arguments", "@C:\\gs\\pdfwrite.txt -sOutputFile=\"d:\\hello.pdf\" -c .setpdfwrite -f -");
PrinterPort.SetValue(@"Command", "c:\\gs\\bin\\gswin32c.exe");
PrinterPort.SetValue(@"Delay", 0x12c);
PrinterPort.SetValue(@"LogFileDebug", 0x0);
PrinterPort.SetValue(@"LogFileName", "");
PrinterPort.SetValue(@"LogFileUse", 0x0);
PrinterPort.SetValue(@"Output", 0x0);
PrinterPort.SetValue(@"Printer", "Send To Cool Printer");
PrinterPort.SetValue(@"PrintError", 0x0);
PrinterPort.SetValue(@"RunUser", 0x0);
PrinterPort.SetValue(@"ShowWindow", 0x0);
}
PrinterPort.Close();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.