PrintJobStatus Enumeration (System.Printing)

Switch View :
ScriptFree
.NET Framework Class Library
PrintJobStatus Enumeration

Specifies the current status of a print job in a print queue.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Printing
Assembly:  System.Printing (in System.Printing.dll)
Syntax

Visual Basic
<FlagsAttribute> _
Public Enumeration PrintJobStatus
C#
[FlagsAttribute]
public enum PrintJobStatus
Visual C++
[FlagsAttribute]
public enum class PrintJobStatus
F#
[<FlagsAttribute>]
type PrintJobStatus
Members

Member name Description
Retained The print job is retained in the print queue after printing.
Completed The print job is complete, including any post-printing processing.
Restarted The print job was blocked but has restarted.
UserIntervention The printer requires user action to fix an error condition.
Blocked An error condition, possibly on a print job that precedes this one in the queue, blocked the print job.
Deleted The print job was deleted from the queue, typically after printing.
Printed The print job printed.
PaperOut The printer is out of the required paper size.
Offline The printer is offline.
Spooling The print job is spooling.
Deleting The print job is in the process of being deleted.
Paused The print job is paused.
None The print job has no specified state.
Printing The print job is now printing.
Error The print job is in an error state.
Remarks

This enumeration is used primarily as the value of the JobStatus property.

Examples

The following example shows how to use this enumeration when diagnosing a problem with a print job.

Visual Basic

		' Check for possible trouble states of a print job using the flags of the JobStatus property
		Friend Shared Sub SpotTroubleUsingJobAttributes(ByVal theJob As PrintSystemJobInfo)
			If (theJob.JobStatus And PrintJobStatus.Blocked) = PrintJobStatus.Blocked Then
				Console.WriteLine("The job is blocked.")
			End If
			If ((theJob.JobStatus And PrintJobStatus.Completed) = PrintJobStatus.Completed) OrElse ((theJob.JobStatus And PrintJobStatus.Printed) = PrintJobStatus.Printed) Then
				Console.WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked.")
			End If
			If ((theJob.JobStatus And PrintJobStatus.Deleted) = PrintJobStatus.Deleted) OrElse ((theJob.JobStatus And PrintJobStatus.Deleting) = PrintJobStatus.Deleting) Then
				Console.WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted.")
			End If
			If (theJob.JobStatus And PrintJobStatus.Error) = PrintJobStatus.Error Then
				Console.WriteLine("The job has errored.")
			End If
			If (theJob.JobStatus And PrintJobStatus.Offline) = PrintJobStatus.Offline Then
				Console.WriteLine("The printer is offline. Have user put it online with printer front panel.")
			End If
			If (theJob.JobStatus And PrintJobStatus.PaperOut) = PrintJobStatus.PaperOut Then
				Console.WriteLine("The printer is out of paper of the size required by the job. Have user add paper.")
			End If

			If ((theJob.JobStatus And PrintJobStatus.Paused) = PrintJobStatus.Paused) OrElse ((theJob.HostingPrintQueue.QueueStatus And PrintQueueStatus.Paused) = PrintQueueStatus.Paused) Then
				HandlePausedJob(theJob)
				'HandlePausedJob is defined in the complete example.
			End If

			If (theJob.JobStatus And PrintJobStatus.Printing) = PrintJobStatus.Printing Then
				Console.WriteLine("The job is printing now.")
			End If
			If (theJob.JobStatus And PrintJobStatus.Spooling) = PrintJobStatus.Spooling Then
				Console.WriteLine("The job is spooling now.")
			End If
			If (theJob.JobStatus And PrintJobStatus.UserIntervention) = PrintJobStatus.UserIntervention Then
				Console.WriteLine("The printer needs human intervention.")
			End If

		End Sub 'end SpotTroubleUsingJobAttributes


C#

// Check for possible trouble states of a print job using the flags of the JobStatus property
internal static void SpotTroubleUsingJobAttributes(PrintSystemJobInfo theJob)
{
    if ((theJob.JobStatus & PrintJobStatus.Blocked) == PrintJobStatus.Blocked)
    {
        Console.WriteLine("The job is blocked.");
    }
    if (((theJob.JobStatus & PrintJobStatus.Completed) == PrintJobStatus.Completed)
        || 
        ((theJob.JobStatus & PrintJobStatus.Printed) == PrintJobStatus.Printed))
    {
        Console.WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked.");
    }
    if (((theJob.JobStatus & PrintJobStatus.Deleted) == PrintJobStatus.Deleted)
        || 
        ((theJob.JobStatus & PrintJobStatus.Deleting) == PrintJobStatus.Deleting))
    {
        Console.WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted.");
    }
    if ((theJob.JobStatus & PrintJobStatus.Error) == PrintJobStatus.Error)
    {
        Console.WriteLine("The job has errored.");
    }
    if ((theJob.JobStatus & PrintJobStatus.Offline) == PrintJobStatus.Offline)
    {
        Console.WriteLine("The printer is offline. Have user put it online with printer front panel.");
    }
    if ((theJob.JobStatus & PrintJobStatus.PaperOut) == PrintJobStatus.PaperOut)
    {
        Console.WriteLine("The printer is out of paper of the size required by the job. Have user add paper.");
    }

    if (((theJob.JobStatus & PrintJobStatus.Paused) == PrintJobStatus.Paused)
        || 
        ((theJob.HostingPrintQueue.QueueStatus & PrintQueueStatus.Paused) == PrintQueueStatus.Paused))
    {
        HandlePausedJob(theJob);
        //HandlePausedJob is defined in the complete example.
    }

    if ((theJob.JobStatus & PrintJobStatus.Printing) == PrintJobStatus.Printing)
    {
        Console.WriteLine("The job is printing now.");
    }
    if ((theJob.JobStatus & PrintJobStatus.Spooling) == PrintJobStatus.Spooling)
    {
        Console.WriteLine("The job is spooling now.");
    }
    if ((theJob.JobStatus & PrintJobStatus.UserIntervention) == PrintJobStatus.UserIntervention)
    {
        Console.WriteLine("The printer needs human intervention.");
    }

}//end SpotTroubleUsingJobAttributes


Visual C++

// Check for possible trouble states of a print job using the flags of the JobStatus property
static void SpotTroubleUsingJobAttributes (PrintSystemJobInfo^ theJob) 
{
   if ((theJob->JobStatus & PrintJobStatus::Blocked) == PrintJobStatus::Blocked)
   {
      Console::WriteLine("The job is blocked.");
   }
   if (((theJob->JobStatus & PrintJobStatus::Completed) == PrintJobStatus::Completed)
      || 
      ((theJob->JobStatus & PrintJobStatus::Printed) == PrintJobStatus::Printed))
   {
      Console::WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked.");
   }
   if (((theJob->JobStatus & PrintJobStatus::Deleted) == PrintJobStatus::Deleted)
      || 
      ((theJob->JobStatus & PrintJobStatus::Deleting) == PrintJobStatus::Deleting))
   {
      Console::WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted.");
   }
   if ((theJob->JobStatus & PrintJobStatus::Error) == PrintJobStatus::Error)
   {
      Console::WriteLine("The job has errored.");
   }
   if ((theJob->JobStatus & PrintJobStatus::Offline) == PrintJobStatus::Offline)
   {
      Console::WriteLine("The printer is offline. Have user put it online with printer front panel.");
   }
   if ((theJob->JobStatus & PrintJobStatus::PaperOut) == PrintJobStatus::PaperOut)
   {
      Console::WriteLine("The printer is out of paper of the size required by the job. Have user add paper.");
   }
   if (((theJob->JobStatus & PrintJobStatus::Paused) == PrintJobStatus::Paused)
      || 
      ((theJob->HostingPrintQueue->QueueStatus & PrintQueueStatus::Paused) == PrintQueueStatus::Paused))
   {
      HandlePausedJob(theJob);
      //HandlePausedJob is defined in the complete example.
   }

   if ((theJob->JobStatus & PrintJobStatus::Printing) == PrintJobStatus::Printing)
   {
      Console::WriteLine("The job is printing now.");
   }
   if ((theJob->JobStatus & PrintJobStatus::Spooling) == PrintJobStatus::Spooling)
   {
      Console::WriteLine("The job is spooling now.");
   }
   if ((theJob->JobStatus & PrintJobStatus::UserIntervention) == PrintJobStatus::UserIntervention)
   {
      Console::WriteLine("The printer needs human intervention.");
   }
};


Version Information

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference