Murali M

Murali M

  • NA
  • 1
  • 2.4k

PrintTicket in GetPrintJobInfoCollection

Sep 29 2014 9:21 AM
Here is my code. I Get the printticket from print job. I Need Printjob informations like copycount, media size, media type, duplex printing and other details. But I can default values from the printticket like copycount is always 1 and sometime no. of pages in job also comes 0. Now struggle with this problem. I Need Help to solve this problem.
 
PrintServer myPrintServer = new PrintServer(@"\\MyMachine");
 
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
foreach (PrintQueue pq in myPrintQueues)
{

   if (pq.QueueStatus != PrintQueueStatus.Error)
   {
      foreach (PrintSystemJobInfo job in pq.GetPrintJobInfoCollection())
      {  
          if (bNewJob == true)
          {
             PrintTicket pt = job.HostingPrintQueue.CurrentJobSettings.CurrentPrintTicket;
             UpdateText("Current Copies : " + pt.CopyCount.Value.ToString());
             UpdateText("Default Copies : " + dpt.CopyCount.Value.ToString());
             UpdateText("User Copies : " + upt.CopyCount.Value.ToString());
             UpdateText("Full Name :" + job.HostingPrintQueue.FullName.ToString());
             UpdateText("Job ID : " + job.JobIdentifier.ToString());
             UpdateText("Job Name : " + job.JobName.ToString());
             DateTime dt = job.TimeJobSubmitted;
             UpdateText("Submitter :" + job.Submitter.ToString());
             UpdateText("Date:"+dt.Day.ToString()+"/"+dt.Month.ToString()+"/"+ dt.Year.ToString());                                   
             UpdateText("Hosted Server :" + job.HostingPrintServer.Name.ToString());
             UpdateText("No of Pages :" + job.NumberOfPages.ToString());
         }
     }
  }
}