使用IMsRdpClient进行打印机重定向 [英] Printer redirection with IMsRdpClient

查看:88
本文介绍了使用IMsRdpClient进行打印机重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,该应用程序必须在重定向的打印机上从终端服务器打印文档.我可以启动远程Adobe Reader,但是当我尝试打印某些内容时,却看不到HP打印机. 打印机选择列表.列表中存在XPSDocumentWriter(重定向),打印机重定向的某些部分起作用.当我通过不带我的应用程序的远程桌面连接连接到服务器时,就会显示HP打印机.该代码段是 在下面.

I'm writing an application which  must print documents from the terminal server on redirected printers. I'm able to launch remote Adobe Reader  but when I'm trying to print something I don't see my HP printer in the printer selection list. Some part of printer redirection works as XPSDocumentWriter(redirected) is present in the list. And the HP printer is shown when I'm connecting to the server via remote desktop connection without my application. The code snippet is below.

            IMsRdpClient7客户端=(IMsRdpClient7)rdp.GetOcx();
            client.Server =服务器;
            client.AdvancedSettings8.RDPPort =端口;
            client.UserName = tbLogin.Text;
           受保护的IMsTscNonScriptable =(IMsTscNonScriptable)rdp.GetOcx();
            secure.ClearTextPassword = tbPassword.Text;
            client.RemoteProgram2.RemoteProgramMode = true;
            client.AdvancedSettings8.RedirectDrives = true;
            client.AdvancedSettings8.RedirectDirectX = true;
            client.AdvancedSettings8.RedirectClipboard = true;
            client.AdvancedSettings8.DisableRdpdr = Convert.ToInt32(false); ;
            client.AdvancedSettings2.GrabFocusOnConnect = true;
            client.AdvancedSettings2.DisableCtrlAltDel = Convert.ToInt32(true);
            client.AdvancedSettings2.RedirectPorts = true;
            client.AdvancedSettings2.RedirectPrinters = true;
            client.AdvancedSettings2.RedirectSmartCards = true;
            client.AdvancedSettings6.RedirectDevices = true;
            client.AdvancedSettings6.RedirectPOSDevices = true;
            var ocx = rdp.GetOcx()as MSTSCLib.IMsRdpClientNonScriptable3;
           如果(ocx!= null)
            {
                ocx.RedirectDynamicDevices = true;
                ocx.RedirectDynamicDrives = true;
            }

            IMsRdpClient7 client = (IMsRdpClient7)rdp.GetOcx();
            client.Server = server;
            client.AdvancedSettings8.RDPPort = port;
            client.UserName = tbLogin.Text;
            IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
            secured.ClearTextPassword = tbPassword.Text;
            client.RemoteProgram2.RemoteProgramMode = true;
            client.AdvancedSettings8.RedirectDrives = true;
            client.AdvancedSettings8.RedirectDirectX = true;
            client.AdvancedSettings8.RedirectClipboard = true;
            client.AdvancedSettings8.DisableRdpdr = Convert.ToInt32(false); ;
            client.AdvancedSettings2.GrabFocusOnConnect = true;
            client.AdvancedSettings2.DisableCtrlAltDel = Convert.ToInt32(true);
            client.AdvancedSettings2.RedirectPorts = true;
            client.AdvancedSettings2.RedirectPrinters = true;
            client.AdvancedSettings2.RedirectSmartCards = true;
            client.AdvancedSettings6.RedirectDevices = true;
            client.AdvancedSettings6.RedirectPOSDevices = true;
            var ocx = rdp.GetOcx() as MSTSCLib.IMsRdpClientNonScriptable3;
            if (ocx != null)
            {
                ocx.RedirectDynamicDevices = true;
                ocx.RedirectDynamicDrives = true;
            }

推荐答案

您好,Volvavic,

Hi Volvavic,

谢谢您在这里发布.

对于您的问题,您是否表示应用程序找不到HP打印机?

For your question, do you mean your application could not find the HP printer?

请检查以下链接.

https://www.codeproject.com/Articles/9296/HP-PCL-PCL -打印

您可以下载源文件以获取有关如何获得HP打印机的参考.

You could download the source file for reference about how to get the HP printer.

如果我误解了您想要什么,请随时与我们联系.

If I misunderstand what you want, please feel free to contact us.

最好的问候,

温迪


这篇关于使用IMsRdpClient进行打印机重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆