1.
Create a process on the remote machine name that has installed the printer
Find a way that this machine can access the file you want to print and just print it.
public class MyProcess
{
// These are the Win32 error code for file not found or access denied.
const int ERROR_FILE_NOT_FOUND =2;
const int ERROR_ACCESS_DENIED = 5;
/// <summary>
/// Prints a file with a .doc extension.
/// </summary>
public void PrintDoc()
{
Process myProcess = new Process();
myProcess.MachineName = "myremotemachine"; // without \
try
{
// Get the path that stores user documents.
string myDocumentsPath =
Environment.GetFolderPath(Environment.SpecialFolder.Personal);
myProcess.StartInfo.FileName = myDocumentsPath + "\\MyFile.doc";
myProcess.StartInfo.Verb = "Print";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
Console.WriteLine(e.Message + ". Check the path."

;
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
// Note that if your word processor might generate exceptions
// such as this, which are handled first.
Console.WriteLine(e.Message + ". You do not have permission to print this file."

;
}
}
}
public static void Main()
{
MyProcess myProcess = new MyProcess();
myProcess.PrintDoc();
}
}
2. Implement your application as client and another application as a service that is running on the machine where the printer is working.
Use System.Net.Sockets class to implement client/server.
On the server side the above code still to be used but you can improve it by adding the notifications to the client by adding the followings:
myProcess.EnableRaisingEvents = true;
myProcess.Exited += new EventHandler(captureOut);
private void captureOut(object sender, EventArgs e)
{
// notify the user (client application) here
}
More than that, you could have above code in a thread that is doing only the Print and is waiting for the server application when it is done.
I hope this help.
-obislavu-