hmm one second .... Here's some bit of code I used in the specified guerilla project.
///
numele fisierului
public static void ConvertPdfToTiff(string Filen)
{
//try
//{
// StringCollection printers = GetPrintersCollection();
// if (printers.IndexOf("ELOPrin
ter") == -1)
// {
// MessageBox.Show("Instalati
ELOPrinter si restartati aplicatia");
// return;
// }
//}
//catch
//{
//}
System.Diagnostics.Process
P = new System.Diagnostics.Process
();
P.StartInfo.FileName = Filen.ToString();
P.StartInfo.CreateNoWindow
= true;
P.StartInfo.WindowStyle = System.Diagnostics.Process
WindowStyl
e.Hidden;
P.StartInfo.Verb = "print";
P.Start();
P.Dispose();
bool jobExistent = false;
while (!jobExistent)
{
StringCollection jobs = GetPrintJobsCollection("EL
OPrinter")
;
if (jobs.Count == 1) jobExistent = true;
}
jobExistent = true;
while (jobExistent)
{
StringCollection jobs = GetPrintJobsCollection("EL
OPrinter")
;
if (jobs.Count == 0) jobExistent = false;
}
System.Diagnostics.Process
[] myProcesses;
myProcesses = System.Diagnostics.Process
.GetProces
sesByName(
"AcroRd32"
);
foreach (System.Diagnostics.Proces
s myProcess in myProcesses)
{
myProcess.Kill();
}
}
///
/// Aceasta Metoda returneaza lista imprimantelor instalate
/// ///
lista imprimantelor instalate private static StringCollection GetPrintersCollection()
{
StringCollection printerNameCollection = new StringCollection();
string searchQuery = "SELECT * FROM Win32_Printer";
ManagementObjectSearcher searchPrinters =
new ManagementObjectSearcher(s
earchQuery
);
ManagementObjectCollection
printerCollection = searchPrinters.Get();
foreach (ManagementObject printer in printerCollection)
{
printerNameCollection.Add(
printer.Pr
operties["
Name"].Val
ue.ToStrin
g());
}
return printerNameCollection;
}
///
/// Aceasta metoda returneaza lista job-urilor curente ale unei imprimante
/// ///
numele imprimantei
///
lista job-urilor private static StringCollection GetPrintJobsCollection(str
ing printerName)
{
StringCollection printJobCollection = new StringCollection();
string searchQuery = "SELECT * FROM Win32_PrintJob";
ManagementObjectSearcher searchPrintJobs =
new ManagementObjectSearcher(s
earchQuery
);
ManagementObjectCollection
prntJobCollection = searchPrintJobs.Get();
foreach (ManagementObject prntJob in prntJobCollection)
{
System.String jobName = prntJob.Properties["Name"]
.Value.ToS
tring();
char[] splitArr = new char[1];
splitArr[0] = Convert.ToChar(",");
string prnterName = jobName.Split(splitArr)[0]
;
string documentName = prntJob.Properties["Docume
nt"].Value
.ToString(
);
if (String.Compare(prnterName
, printerName, true) == 0)
{
printJobCollection.Add(doc
umentName)
;
}
}
return printJobCollection;
}