This project is read-only.

Getting started with the PrintQueueWatch component

The getting started page is a quick and dirty subset of the documentation based on the format: "I want to ....."

I want to ... get a list of all the documents that are printed on one printer

In order to get a list of the documents printed on a printer you need to monitor that printer and when you get a JobWritten event check if the .Printed property is true and if so, make a note of that print job's details.

Step 1 : Add the PrintQueueWatch component to your project
To do this slect Project -> References and add a reference to the latest PrintQueueWatch.dll to your project

Step 2: Add an instance of the component on your form
Drag the component from the toolbox onto your form surface. Visual Studio will create an instance and wire it up.

Imports PrinterQueueWatch

Public Class Form1
Inherits System.Windows.Forms.Form

Private WithEvents pmon As New PrinterMonitorComponent

Step 3: Add an event handler to handle the JobAdded event
Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As PrintJobEventArgs) Handles pmon.JobAdded

With CType(e, PrintJobEventArgs)
End With

End Sub

Step 4: Add the printers to monitor
In the form load event handler add all the local device names to the list of printers to monitor

Public Sub New()

'This call is required by the Windows Form Designer.

'Add any initialization after the InitializeComponent() call
For Each p As PrinterInformation In New PrinterInformationCollection
Trace.WriteLine(String.Format("Printer {0} added to monitor", p.PrinterName))
Next p

End Sub

Step 5: Add code to close the monitoring nicely
Add the following in the form unload handler
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Catch EX As Exception
End Try
End Sub

Last edited Nov 8, 2009 at 7:51 PM by Merrion, version 5


Heinze Jan 31, 2013 at 11:36 AM 
Hi, thank you for component. I have a question, please: If duplex printing, how to get information about it?

clntnco Apr 6, 2010 at 10:11 PM 
It says to drag a component from the toolbox onto your form surface. Which componet am I suppose to drag?

wnb31337 Mar 17, 2010 at 4:06 PM 
I want to... get the path of a PrintJob

Merrion Feb 24, 2008 at 11:07 AM 
Any other "I want to.." thoughts, add them as a heading and Iw ill get the documentation updated to include it...