views:

11

answers:

1

Hi,

I am just wanted to know how to print the document library files (document file). I goggled it and unable to find the solution. But during search I found an http://www.sharepointprinting.com/ having a tool which provides a very same type of factuality.
Please guide me. How can I proceed to achieve this type of functionality?

Thanks & regards, Basant

A: 

You could use the WebClient class to download the file to a temporary directory and just use PrintDocument to print it (this could vary greatly depending on whether you want to show a print dialog, if you're using Silverlight, WebForms, WinForms, or some other third party printing tool), but the method to download the file should be the same across all managed platforms.

WebClient client = new WebClient();
string tempFile = Path.GetTempFileName();
string fileUri = "http://mysharepointserver/Shared%20Documents/myFile.doc";

client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.DownloadFile(fileUri, tempFile);
//add some kind of printing logic here
Steve Danner
the question is this How can i print the word document. without showing the print dialog box.
ricky roy
Where Can i download Printdocument and WebClient Class. Do you have an url to download the above two files.
ricky roy
I think you might need to add more information. The fact that you are specifically wanting to print MS Word Documents isn't entirely clear from the original post. Also, are you looking to do this with code or some sort of command line utility?
Steve Danner