Hi All
I was just wondering how the hell you send documents of different type directly to the printer without a preview.
At first I thought this would be easy but so far I have had no joy at all.
Thanks In Advance :wave:
Printable View
Hi All
I was just wondering how the hell you send documents of different type directly to the printer without a preview.
At first I thought this would be easy but so far I have had no joy at all.
Thanks In Advance :wave:
Post Your code
If you are to do the printing yourself using the PrintDocument class, you just call the Print method of the PrintDocument instance. However, I don't think this is what you are after since you want to print different document types and it will be very much impossible to code the PrintDocument.PrintPage event handler to handles every types of documents.
The easiest way is to use a webbrowser control to load the document and call its Print method. You don't have much control using this way, but as long as Internet Explorer can open that file type, you can print it.
The next option is to use Process class and ProcessStartInfo class to start the application of that document type you want to print. For example, if it's a pdf, you start Adobe reader; if it's a doc, you start MS Word; if it's an xls, you start MS Excel... and setting the Verb. You will have a fair amount of control this way, but it requires that:
1. The application supports command line args.
2. You need to look up the the available command line switches for each application so that you can use them correctly.
I use the Process Startinfo to PrintPreview docs.
I have been told that I need to send selected documents to the print que directly without opening any application at all.
Bit of a pain really.
See if this helps you...
http://www.vbdotnetheaven.com/Upload...gDirectly.aspx
Thanks Koolsid but the link is a dead end.
Try it again, I just loaded it and it was fine.
<Off topic>
Printing can also be obtained by transfering th entire data into an excel sheet and calling the print()......but its limitation is it needs the excel version to be installed in the clients machine......
</Off topic>