473,625 Members | 3,318 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 6710
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******** ***********@new s1.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****@blowgoa ts.com> ha scritto nel messaggio
news:vs******** ****@corp.super news.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******** ***********@new s1.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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.pd f"
p.UseShellExecu te = True
System.Diagnost ics.Process.Sta rt(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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.pd f"
p.UseShellExecu te = True
System.Diagnost ics.Process.Sta rt(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.Diagnost ics.ProcessStar tInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.pd f"
p.UseShellExecu te = True
System.Diagnost ics.Process.Sta rt(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
4343
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 version of the form that he/she has just completed. It also needs to be submitted in the usual way via email. I need to add a couple of extra items to this printed version for someone to sign. Any ideas how I can go about such a task? Is it...
6
2136
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 do in Approach that appear to require some subtle and complex manipulation in Access. Herein lies my present problem. I have a number of tables, including one called "tblPO", which contains purchase orders. Some of the details of these change...
2
2760
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 files could have to be transferred .ie Exe , mp3 , dat .. any kind . Do i need to convert these files ? When i normally send text files i convert them to Ascii bytes using Encoding.Ascii.getBytes() . Will it work with Exe files and all others ??...
4
6993
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 except anything to do with drivers. I have added a reference to the PRNADMIN.DLL from MS Windows 2003 Tool Kit into my project to do all of the above, but when i try to enumerate printers i received the following error....
0
1154
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 = "attachment;filename=order123.zip" Response.AddHeader("Content-Disposition", myheader) Response.WriteFile(FileName, StartPos, FileSize)
6
2788
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 send him a file or he wants to send me a file, it just needs to be a very basic program for sending files up to maximum 6mb. thnx a lot Peter
0
1087
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 and not? I get really confused here. Please check my code and give me some idea or clue or help please :). Thanks in advance. My code is like this: Dim DBConnection As SqlConnection Dim WithEvents SPConnection As SerialPort = New...
0
1147
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 vpn only. what ip or method should i used to broadcast over vpn. If i use 255.255.255.255, it broadcast over vpn and LAN both but i have to send only over vpn network. Please help and suggest any method for broadcasting. If anyone know how can i...
6
3517
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 (empty) the form on (release) { _parent.getURL("contact.php","_blank", "GET"); _parent.name=""; _parent.phone="";
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7184
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6118
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.