Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Resume any paused print jobs in the print queue in vb .net 2005

Hello everybody i was wondering if you guys could help me out
Im trying to write a program that will resume any print jobs in the print queue but i am not getting very far i keep on running into code that will not work unless i have the user input the print job id but i dont want to do that all i need to do is just have a program look at the print queue and resume anything that is currently paused in there.

thanx
rob
[437 byte] By [bob2600] at [2007-11-11 10:09:38]
# 1 Re: Resume any paused print jobs in the print queue in vb .net 2005
hi, sorry about my late. your problem would be very simple if You used Net Framework 3.0 because there is a System.printing NameSpace. now, I'll give you my sample code:
//===============
using System;
using System.Collections.Generic;
using System.Text;
using System.Printing;

namespace job_ticket
{
class Program
{
static void Main(string[] args)
{
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue q = LocalPrintServer.GetDefaultPrintQueue();
Console.WriteLine("List PrintJobs in the printqueue\n");
foreach (PrintSystemJobInfo pj in q.GetPrintJobInfoCollection())
{
Console.WriteLine("JOB : {0}", pj.Name.ToString());
pj.Pause();
Console.WriteLine("\t - Status:{0}\n", pj.JobStatus.ToString());
}
string end;
end = Console.ReadLine();
}
}
}
//===============
requirement : Net FameWork 3.0
I tested it and it run correctly. Goodluck!
chienquang at 2007-11-11 20:48:32 >