From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example uses the .NET API to search for local and default printers, and purges the queues of all printers.
Description
This example shows how to programmatically purge the print jobs of all printers on your local machine. It also attempts to purge the print queue of your default printer. In some cases, this will be included on the local printer list, but sometimes it is a networked printer. If you do not have sufficient priviledges, an error will be thrown when attempting to purge the queue. Typically, you only have priviledges to purge wueus on your local machine, assuming you have administrative priviledges.
Play with this, and comment with your thoughts. This uses the .NET API to the System.Printing namespace and can be expanded to retrieve all active jobs, pause printing, cancel specific jobs on specific printers, or moving jobs to other printers.
Requirements
Steps to Implement or Execute Code
Additional Information or References
On newer versions of the .NET API it might be necessary to change the "GetEnumerator" invoke node to "GetEnumerator()"
Front Panel of the VI
Block Diagram of the VI
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
can you upload it for Labview 8.5
I am using an example called "Programmatically Purge All Print Jobs on Local Printers" from PFlores. In this VI there is a property node called PrinterQueue, and is set to retrieve all printers names availables on my PC. The names are all found successfully everytime. I tried to add another item on the same property node called IsOffline, to find what printers are offline and online. This function is always returning False values regardless of printers being off or on. Do you know if I need to do something else?
Thanks for the big help.
Regards,
This seemed to work for me: http://screencast.com/t/YKZ5EQ8N4CO
I remember this API being very strange to work with, if that doesn't help, may have to read up in the MSDN docs, good luck!
Ok thank you for your response. I tried your example but I couldn't make it work. I' m going to follow your advise about reading MSDN doc about System.Printing namespace.
Regards.
Date: Mon, 4 Apr 2011 22:01:48 -0500
From: web.community@ni.com
To: kapella98@hotmail.com
Subject: Re: - Programmatically Purge All Print Jobs on Local Printers
Community
Programmatically Purge All Print Jobs on Local Printers
new comment by pflores View all comments on this document
This seemed to work for me: http://screencast.com/t/YKZ5EQ8N4CO
I remember this API being very strange to work with, if that doesn't help, may have to read up in the MSDN docs, good luck!
System.Printing namespace
Reply to this email to respond to pflores's comment.