for print Document i have used the following code
Word.Application ObjWord = new Word.Application(); //Create Word Application
object M = Type.Missing; //M is missing...hi..hi
object V = StrFileName; //Convert to Object..
object I = true; //Convert to Object
object myTrue = true; // Print in background
object myFalse = false;
try
{
if (StrFileName.EndsWith(".doc")) //Ends with .doc. itz Word document....
{
Word.Document doc = ObjWord.Documents.Open(ref V, ref M, ref myFalse, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M);
doc.PrintOut(ref I, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M);
doc.Close(ref M, ref M, ref M);
while (ObjWord.BackgroundPrintingStatus > 0)
{
System.Threading.Thread.Sleep(250);
}
ObjWord.Quit(ref M, ref M, ref M);
return true;
}
else //for all other types..I did check for .txt,.pdf and .Msg
{
System.Diagnostics.Process P = new Process(); //Create a process
P.StartInfo.FileName = StrFileName.ToString(); //convert ....> Readable
P.StartInfo.CreateNoWindow = true; //Perfect...Create No Window
P.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//WindowStyle---->HIDDEN
P.StartInfo.Verb = "print";
P.Start(); //Start the process
P.Dispose();
return true;
}
}
catch (Exception ee) //Err Handler.....
{
MessageBox.Show(ee.Message);
return false;
}
from this code the file is opening in the word and it is asking to "open readonly " file.
i don't want open the document
i just want to print the document without opening the Document.
and i also need code for preview of the document without opening it.

Print word Document
canislupus
object myTrue = true;
Word.Document doc = ObjWord.Documents.Open(ref V, ref M, ref myTrue, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M, ref M);