简体   繁体   English

UWP直接从Windows应用程序打印而不带打印对话框

[英]UWP Printing from Windows app directly without bringing Print Dialog

  1. Does POS printer just support Epson printers? POS打印机是否只支持Epson打印机? (related to https://msdn.microsoft.com/en-us/library/windows/apps/mt426652 ) (与https://msdn.microsoft.com/en-us/library/windows/apps/mt426652相关)

  2. How to send a document directly to the printer without showing Print Dialog? 如何在不显示“打印对话框”的情况下将文档直接发送到打印机?

ESC/POS is a command system created by Epson used across a wide range of POS printer systems, aimed at avoiding incompatible command sets by providing universal applicability. ESC / POS是Epson在各种POS打印机系统中使用的命令系统,旨在通过提供通用的适用性来避免不兼容的命令集。 Most modern printers support ESC/POS. 大多数现代打印机都支持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. POS打印机 API可用于支持ESC / POS的所有打印机。 Please refer to Epson ESC/POS with formatting . 请参考Epson ESC / POS格式化

For your second question, using POS printer API, you can print without a Print Dialog. 对于第二个问题,使用POS printer API,您可以在没有打印对话框的情况下进行打印。

But I assume, what you want is Windows.Graphics.Printing namespace . 但我想,你想要的是Windows.Graphics.Printing命名空间 For this printing in a UWP app, the Print Preview UI must be shown to guide user complete the printing operation. 对于在UWP应用程序中的此打印,必须显示打印预览UI以指导用户完成打印操作。

You can refer to the official POS printer sample and Printing sample . 您可以参考官方POS打印机样品打印样品

Update 2/1/2016: 2016年2月1日更新:

using POS printer API, you can print without a Print Dialog. 使用POS打印机API,您可以打印没有打印对话框。

@Seb, this is my personal conclusion, the official document of POS printer doesn't mention anything about a UI dialog. @Seb,这是我个人的结论,POS打印机的官方文档没有提到有关UI对话的任何内容。

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 但是在文档和官方样本的简短示例中,当我们使用pos设备进行打印时,我们首先创建一个打印作业,然后使用我们要打印的内容调用PrintLine(string)方法,最后执行它/他们用ExecuteAsync方法,这个方法

Runs the print job on the receipt printer station asynchronously. 异步运行收据打印机站上的打印作业。

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. 在正常打印中,当我们想要从我们的应用程序打印文档时,我们调用ShowPrintUIAsync()方法,此方法将显示一个对话框,为用户提供指导,帮助他们完成与打印相关的oricess。

@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. @Hamed,这个Pos打印机API不能支持那些没有ESC / POS的设备,我不确定是否可以将命令发送到你的打印机并通过串口得到它的响应,我想你可能会阅读开发文档你的打印机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM