PrinterQueueWatch 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PrinterQueueWatch --version 1.0.0
NuGet\Install-Package PrinterQueueWatch -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PrinterQueueWatch" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PrinterQueueWatch --version 1.0.0
#r "nuget: PrinterQueueWatch, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PrinterQueueWatch as a Cake Addin
#addin nuget:?package=PrinterQueueWatch&version=1.0.0

// Install PrinterQueueWatch as a Cake Tool
#tool nuget:?package=PrinterQueueWatch&version=1.0.0

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)
        Trace.WriteLine(.PrintJob.UserName)
    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() MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call
    For Each p As PrinterInformation In New PrinterInformationCollection
        pmon.AddPrinter(p.PrinterName)
        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 Try pmon.Dispose() Catch EX As Exception Trace.WriteLine(EX.ToString) End Try End Sub "}

Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net7.0-windows was computed.  net8.0-windows was computed. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 969 5/12/2023
1.0.0 900 4/8/2021