.PrintJob.Document = ""

Mar 4, 2009 at 3:50 PM
Hi, 

We are experiencing some problems with the PrintQueueWatch component which we downloaded from the CodePlex website at version 2.0.4.0 (Thu Feb 21 2008 at 4:00 PM release).


We are using this component in a .Net WinForms application and we need it to monitor and inform us when jobs are successfully printed.  We create an instance of the component in the applications “Main” form and then use a VB class to handle the events raised from the monitor.  In particular we’re handling the JobDeleted and the JobSet events and looking for

 

                If .PrintJob.Printed = True Or .PrintJob.StatusDescription = "Printed" Then

 

to detect whether printing has occurred.

 

In general the PrintQueueWatch component is working fine and our code runs without problem.  We regularly execute fairly large print batches of 50 documents or so and in these case we sometimes fail to pick up that say 2 or 3 document have been printed.  Debugging our code it seems that the source of the problem is that the “Document” property of the PrintJob is coming back as empty and this is the property which ultimately we use to determine which document has successfully been printed.

 

                Dim strDocumentName As String = .PrintJob.Document

 

I wanted to know if: -

 

1)      You’ve heard of anyone else experiencing a blank Document property.

2)      Whether you know of any factors which might lead to this behaviour.

 

Many thanks in advance for any advice you can offer and thank you for the open source use of PrintQueueWatch.

 

 

Coordinator
Mar 5, 2009 at 7:05 AM
Previous releases (prior 1.0.7 IIRC) did miss jobs altogether in high usage scenarios and I introduced the queue between the monitoring loop and the event raising loop.
However on my test rig I don't have a large enough print volume to see this error above.

It is possible that it is caused by the "live" nature of the PrintJob class - i.e. when you get a property from this class it calls RefreshJobInfo to make sure the returned value matches teh current state of the print job.  Maybe try taking this call out of the JobInfo class and see if that improves things? 
Mar 5, 2009 at 12:53 PM
Hi Merrion,

Thanks for the quick reply!
We've been using the PrintQueueWatch component from the compiled .dll's and we've not looked at the source as of yet.
We've found a work around for the issue above (.PrintJob.Document = "") but I have a query regarding Vista....

I've not been able to find the minimum requirements for the component on CodePlex but I have found these on your website and Vista is not listed as a supported operating system.
We've been developing our project on Vista and its works fine in development, however we've had some problems with deployed versions of our project on Vista machines where the JabAdded, JobSet, JobDelete, JobWritten, PrinterInformationChanged events are not firing.  This is only paticular to one or two machines and the component works fine on other test machines we have in the office.  Is this a known issue with Vista?

I should also point out the printers we are printing too and monitoring are networked printers which are shared via our domain controller.
Coordinator
Mar 6, 2009 at 7:40 PM
There is no issue with the control on Vista - indeed my development environment has been Vista for the last couple of years...teh website hasn't been updated in that time which is why there is no mention of Vista there.

However there are additional user permissions ("Manage Printers") that may be required for any applications that monitor the printers.  Suggest you try modifying the permissions of the accopunt running the application to see if that can cure the issue?