The PrinterMonitorComponent allows you to set one or more printers to monitor and raises events in response to events which occur on these printers. Events include a new job being added, pages being printed, job settings changes and a job being deleted from the print queue.

Code example (VB.NET)

    Private WithEvents pmon As New PrinterMonitorComponent

    Public Sub New()

        ' This call is required by the Windows Form Designer.

        ' Monitor all the installed printers 
        For Each p As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            pmon.PrinterInformation(p).PauseAllNewJobs = False
        Next p

    End Sub

    Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As PrintJobEventArgs) Handles pmon.JobAdded

        With CType(e, PrintJobEventArgs)
            Trace.WriteLine("New job added " & .PrintJob.UserName)
        End With

    End Sub


JobAdded - Raised when a new print job is added to a printer queue
JobWritten - Raised when a job is written to on one of the print spool queues being monitored
JobDeleted - Raised when a print job is removed from the queue - either deleted by the user or printed by the printer
JobSet - Raised when a job's properties are changed in one of the print spool queues being monitored
PrinterInformationChanged - Raised when the settings on the printer being monitored change


Monitoring (Boolean) - True if the component is monitoring any printers
DeviceName (String) - The name of the printer to monitor. If multiple printers are to be monitored then the AddPrinter method is used instead
PrintJobs (PrintJobCollection) - The collection of print jobs in the queue of the named device
PrinterInformation - The printer settings of the named device
JobCount (Int32) - The number of print jobs in the queue of the named device


AddPrinter - Adds a named printer to the collection of printers to monitor
RemovePrinter - Removes a named printer from the collection of printers being monitored
Disconnect - Stops all printer monitoring

Other settings

ComponentTraceSwitch - Controls the level of trace information emmitted from the component

Last edited Sep 5, 2014 at 7:57 AM by Merrion, version 4


Merrion Feb 21, 2008 at 8:40 PM 
C# code example wanted - any volunteers?