Help me please .... Sending Files to a printer

  • Thread starter Thread starter Valeria Galvano
  • Start date Start date
V

Valeria Galvano

Hi, I'm a newbie in vb.net.
I have to send to a printer a file that need to be printed.
My problem is that I don't know which kind of document is..
I tried to read the file with a BinaryReader but once I have read the file
( a doc file or an xls or a txt or a psd or another format) how can I say to
the printer what she have to print?
I need to print all printable kind of document.
Thank you in advance
Valeria
 
Your in an interesting situation Valeria,

So what your saying is you want to print ANY kind of document that is sent
to the printer? If so, you would have to create print routines to do that.
In which case you draw the document onto the paper using a printdocument.
Unfortunatly, there is no, just "print this type of file" command.

For an excel file, you would have to start the excel executable (create an
object reference of it will work fine) and then load the workbook and call
the printout method (which you will find there is little documentation for)
Also, excel uses a com interop to communicate with .NET.

Same goes for Photoshop, you would have to open the proper DLL, hope that
the print method is exposed, and go from there. But there is no "universal"
print.

Sorry kiddo. It would be nice though. =)

-CJ
 
I supposed that ....
Hopefully if it exist a universal language to convert the binary in a
printer-understandable language...
many thanks!
Valeria
 
* "Valeria Galvano said:
I have to send to a printer a file that need to be printed.
My problem is that I don't know which kind of document is..
I tried to read the file with a BinaryReader but once I have read the file
( a doc file or an xls or a txt or a psd or another format) how can I say to
the printer what she have to print?
I need to print all printable kind of document.

Depending on the application that is associated with the file type, you can
try this:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.pdf"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Ok, thanks, I will try...
Valeria


Herfried K. Wagner said:
Depending on the application that is associated with the file type, you can
try this:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.pdf"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Back
Top