Does this library support pause- resume facility.

Oct 21, 2013 at 3:06 PM
I have a scenario here where i am monitoring a printer. What happens is when a job is added to a printer it is pause, and only resume after a user action.

OS what i have done is i have added the into a list view. Now i need to invoke a print job from the listview and resume it or delete it.

Prat of the code is below.

Public WithEvents pmon As New PrinterMonitorComponent
Private Delegate Sub AddListViewItemDelegate(ByVal lv As ListView, ByVal lvItem As ListViewItem)

Private Sub AddListViewItem(ByVal lv As ListView, ByVal lvItem As ListViewItem)

    If lv.InvokeRequired Then
        lv.Invoke(New AddListViewItemDelegate(AddressOf AddListViewItem), New Object() {lv, lvItem})
    End If

End Sub

Private Delegate Sub RemoveListViewItemDelegate(ByVal lv As ListView, ByVal lvItem As ListViewItem)

Private Sub RemoveListViewItem(ByVal lv As ListView, ByVal lvItem As ListViewItem)

    If lv.InvokeRequired Then
        lv.Invoke(New RemoveListViewItemDelegate(AddressOf AddListViewItem), New Object() {lv, lvItem})
    End If

End Sub

Public Sub New()

    ' This call is required by the Windows Form Designer.

    ' Monitor all the installed printers 
    pmon.MonitorJobAddedEvent = True
    pmon.MonitorJobDeletedEvent = True
    pmon.MonitorJobSetEvent = True
    pmon.MonitorJobWrittenEvent = True

    For Each p As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters

        pmon.PrinterInformation(p).PauseAllNewJobs = True

    Next p

End Sub

Private Sub pmon_JobAdded(ByVal sender As Object, ByVal e As PrintJobEventArgs) Handles pmon.JobAdded
        Dim lvitem As ListViewItem = New ListViewItem

        With CType(e, PrintJobEventArgs)
            lvitem.Text = Nothing

            With .PrintJob
                lvitem.Text = .JobId

            End With

            AddListViewItem(ListView1, lvitem)

            ' ListView1.Items.Remove(lvitem)
            Trace.WriteLine("New job added " & .PrintJob.UserName)

        End With
    Catch ex As Exception

    End Try
End Sub

So i need to select a job then send a action command, to the job in the printer. e.g like if Select Print the the job that job is printed.

Please help.
Nov 11, 2013 at 2:13 PM
Hi Mugove

Were you able to resume a particular print job again.

If so, could you perhaps share how you have done it..
Dec 2, 2013 at 1:28 PM
May 16, 2014 at 10:39 PM
print it with this command:
Shell("wmic printjob where jobid=56 resume")

I canceled this:
Shell("wmic printjob where jobid=56 delete")