Can we print files directly?

G

Guest

Hello, friends,

In our c#.net windows app, we want to print document (.jpg, .doc, .xls,
etc.) to the selected printer without opening the corresponding app, e.g.
MSPaint for .jpg or Word for .doc.

Is that possible to do this way? Thanks.
 
P

Patrice

Strictly speaking no. Windows doesn't have any idea about how to print an
XLS or DOC file. Printing is done by an application that is able to read
this format as it needs to know what it represents to "draw" the
corresponding printer page...

You can however "directly" print using the print verb (as if you were using
the print context menu that is behind the scene it still launch the
application but generally with a switch that make it "silent" and closes the
application when printing is done).

See :
http://msdn2.microsoft.com/en-us/library/system.diagnostics.processstartinfo.verb.aspx
(use the "print" verb instead of the "printto" verb used in the sample to
print to the default 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