问题描述
POS 打印机只支持爱普生打印机吗?(相关于 https://msdn.microsoft.com/en-us/library/windows/apps/mt426652)
如何将文档直接发送到打印机而不显示打印对话框?
How to send a document directly to the printer without showing Print Dialog?
推荐答案
所以,对于你的第一个问题,我认为答案是否定的.此 POS 打印机 API 可用于所有打印机支持ESC/POS.请参阅Epson ESC/POS 带格式.
So, for your first question, I think the answer is no. This POS printer API can be used for all the printers which support ESC/POS. Please refer to Epson ESC/POS with formatting.
对于您的第二个问题,使用 POS 打印机
API,您可以在没有打印对话框的情况下进行打印.
For your second question, using POS printer
API, you can print without a Print Dialog.
但我假设你想要的是 Windows.Graphics.Printing 命名空间.在 UWP 应用中进行此打印,必须显示打印预览 UI 以指导用户完成打印操作.
But I assume, what you want is Windows.Graphics.Printing namespace. For this printing in a UWP app, the Print Preview UI must be shown to guide user complete the printing operation.
2016 年 2 月 1 日更新:
使用 POS 打印机 API,您可以在没有打印对话框的情况下进行打印.
@Seb,这是我个人的结论,POS打印机的官方文档没有提到UI对话框.
@Seb, this is my personal conclusion, the official document of POS printer doesn't mention anything about a UI dialog.
但是在文档和官方示例中的简短示例中,当我们使用pos设备打印时,我们首先创建一个打印作业,然后调用PrintLine(string) 方法与我们想要打印的内容,最后,我们使用 ExecuteAsync方法,这个方法
But in the short sample in the document and official sample, when we print with a pos device, we create a print job at first, then call the PrintLine(string) method with the content which we want to print, at last, we execute it/them with ExecuteAsync method, this method
在收据打印机站上异步运行打印作业.
在此过程中,我们不会显示任何与正常打印不同的对话框.在正常打印中,当我们想从我们的应用程序打印文档时,我们调用 ShowPrintUIAsync() 方法,该方法会显示一个对话框,为用户提供指导,帮助他们完成打印相关的操作.
In this process, we don't show any dialog unlike in the normal printing. In the normal printing, when we want to print a document from our app, we call ShowPrintUIAsync() method, this method will show a dialog to provide guidance for users to help them complete a printing-related oricess.
@Hamed,这个 Pos 打印机 API 不能支持那些没有 ESC/POS 的设备,我不确定是否可以向您的打印机发送命令并通过串口获得响应,我想您可以阅读开发打印机的文档.
@Hamed, this Pos printer API can't support those device without ESC/POS, I'm not sure if it possible to send commands to your printer and get response from it through serial port, I think you may read the develop document of your printer.
这篇关于UWP 直接从 Windows 应用程序打印而不带打印对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!