Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP Printing from Windows app directly without bringing Print Dialog

Tags:

c#

printing

uwp

  1. Does POS printer just support Epson printers? (related to https://msdn.microsoft.com/en-us/library/windows/apps/mt426652)

  2. How to send a document directly to the printer without showing Print Dialog?

like image 830
Hamed Avatar asked Jan 27 '16 05:01

Hamed


1 Answers

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. Most modern printers support 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.

For your second question, using POS printer API, you can print without a Print Dialog.

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.

You can refer to the official POS printer sample and Printing sample.

Update 2/1/2016:

using POS printer API, you can print without a Print Dialog.

@Seb, this is my personal conclusion, the official document of POS printer doesn't mention anything about a UI dialog.

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

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.

@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.

like image 128
Grace Feng Avatar answered Nov 15 '22 13:11

Grace Feng