当前位置:编程学习 > C#/ASP.NET >>

C#调用CODESOFT打印标签,如何指定打印机?

C#调用CODESOFT打印标签,代码里如何设定某台打印机?而不是用默认的打印机打印?
 LabelManager2.Document doc = lb.ActiveDocument;
.............................
 doc.PrintDocument(Num); --------------------编程问答-------------------- 下面的代码对你也许有启发:

            LabelManager2.Application OLE_Server = new LabelManager2.Application();
            OLE_Server.Documents.Open("C:\\1.lab", true);
            LabelManager2.Document OLE_DOC = OLE_Server.ActiveDocument;

            //获得所有打印机名称
            Strings vars = OLE_Server.PrinterSystem().Printers(enumKindOfPrinters.lppxAllPrinters);
            //获得需要的打印机名称    打印机固定可直接给名称值
            string printName = vars.Item(7);

            //切换打印机
            OLE_DOC.Printer.SwitchTo(printName);

            OLE_DOC.PrintLabel(1, 1, 1, 1, 1, "");
            OLE_DOC.FormFeed(); --------------------编程问答-------------------- 调用SwitchTo方法时返回false,没有切换到指定的打印机,而一直使用Codesoft软件里设置的默认打印机进行打印,该怎么解决?
OLE_DOC.Printer.SwitchTo(printName, PrintPort, true); //这里返回false,Printer对象的Name属性还是原来的值,没有改为传入的printName参数的值

补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,