473,499 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Nov 20 '05 #1
5 6695
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
"Valeria Galvano" <va***@tiscali.it> wrote in message
news:W2*******************@news1.tin.it...
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

Nov 20 '05 #2
I supposed that ....
Hopefully if it exist a universal language to convert the binary in a
printer-understandable language...
many thanks!
Valeria

"CJ Taylor" <no****@blowgoats.com> ha scritto nel messaggio
news:vs************@corp.supernews.com...
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
"Valeria Galvano" <va***@tiscali.it> wrote in message
news:W2*******************@news1.tin.it...
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


Nov 20 '05 #3
* "Valeria Galvano" <va***@tiscali.it> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Ok, thanks, I will try...
Valeria
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ha scritto nel
messaggio news:bq*************@ID-208219.news.uni-berlin.de...
* "Valeria Galvano" <va***@tiscali.it> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
Thank you very much, it's perfectly working!
Regards
Valeria

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ha scritto nel
messaggio news:bq*************@ID-208219.news.uni-berlin.de...
* "Valeria Galvano" <va***@tiscali.it> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4334
by: tommy | last post by:
Newbie to the group.....hope you guys can help. I need to be able to have a button at the bottom of a form page (like the submit & reset buttons) to provide the user with a printer friendly...
6
2118
by: John Baker | last post by:
Hi: As those who have looked at this newsgroup recently will realize, I am a neophyte with Access, although I have experienced with Approach (the Lotus product). There are things I could easily...
2
2752
by: Ebrahim | last post by:
Does any one have any suggestion of Sending Files over a Network ? using TcpClient class in C#. I need suggestions on transferring huge files ( > 5MB) reliably over the stream . Also any kind of...
4
6982
by: Brett Mostert | last post by:
Hi, I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. And even add printers, ports, and drivers and setup printers. Sofar i can do all of the following...
0
1149
by: Buddy Ackerman | last post by:
I'm sending file to the client (see sample code below) but when I send a large file the user gets a document contains no data message. response.contenttype = "application/x-unknown" myheader =...
6
2779
by: Piedro | last post by:
Hi, has anyone in here got a good example or some hints on how to send a file directly from one pc to another pc using vb.net, for example I've got my pc's ip and a friends pc's ip and I want to...
0
1074
by: Lemune | last post by:
Hello everyone. I'm creating windows service application to capture data from my PABX, and send the data to sql server. My question is how could my application know when that PABX is sending data...
0
1142
by: salman | last post by:
Hello i have to broadcast over vpn. I have local network and vpn, LAN ips are 192.168.1.x and vpn ips are 10.0.0.x. i am creating vpn thru windows server 2003 RAS. i have to broadcast msgs over...
6
3510
by: Derek | last post by:
Hi all any one please help, i have a buttin in flash 8 which gets a form contact.php but when it is pressed the emial ruturns empty as follows 1 the flash button 2 the form 3 the email outcome...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.