How to redirect output to printer?

J

Jani Järvinen [MVP]

Hello Raj,
How to redirect output to printer in C#?

Could you provide us some information about what you need to implement? That
is, would you like to print the output of a console application, or do you
have a text file that you would like to send to the printer (from the
command-line)?

If you could send us more information, then we could be of better
assistance.

Thanks!

--
Regards,

Jani Järvinen
C# MVP
Vantaa, Finland
(e-mail address removed)
 
N

news.microsoft.com

I am just preparing a report displayed on console and as well as stored on a
text file.

If the user wishes, console output is to be redirect to printer

If the user wishes, he can open the report file through C# application and
print it
 
J

Jani Järvinen [MVP]

Hello!
I am just preparing a report displayed on console and as well as stored on
a text file.
If the user wishes, console output is to be redirect to printer
If the user wishes, he can open the report file through C# application and
print it

The requirements you have sound like that you need probably two
applications: one for the console and one for the possible GUI (if I
understood you correctly). Displaying the report on the console is easy: you
just write the text you want using System.Console.WriteLine. Printing might
be possible using a simple redirect, or you could implement printing in the
GUI application only.

If you need to implement the same functionality in the console and GUI
applications, then you might want to use command-line parameters in the
console application to select whether you want to view or print, for
example. Of course, if the console application is to be interactive in
nature, then you can simply ask the user's input.

Hope this helps!

--
Regards,

Jani Järvinen
C# MVP
Vantaa, Finland
(e-mail address removed)
 
N

news.microsoft.com

It is still not clear about how to redirect the output to the printer like
the way I did I/O

Console.SetOut(Console.Out)
Console.SetIn(Console.In)

what's the exact method to redirect output to the printer?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top