printqueue

How to print reports in submitted order using .NET

帅比萌擦擦* 提交于 2019-12-25 02:00:34
问题 Our VB WinForms application prints a series reports using the standard PrintDocument object, some with multiple pages. My client has pointed out the the hard copy reports are not printed in the correct order. When I debug the code, I can verify the reports are generated in the correct order, but when I inspect the print queue the reports are not displayed in the order they were submitted. When I sort the queue by Submitted (date-time), the correct order of reports is shown. Is there a way to

PrintQueue is the printer the default printer? [duplicate]

被刻印的时光 ゝ 提交于 2019-12-24 04:47:07
问题 This question already has an answer here : How to determine the default printer using WPF? (1 answer) Closed 23 days ago . I'm making my own dialog for printing in my application, now I have this code to put all the printers in a combobox: PrintServer server = new PrintServer(); foreach (PrintQueue queue in server.GetPrintQueues()) { cboPrinters.Items.Add(queue.FullName); } However, I would need select the default printer, how can I see which one is the default printer? 回答1: var

C# - Enumerating network printers on remote machine

。_饼干妹妹 提交于 2019-12-13 02:27:07
问题 I am writing an application to check if a network printer from a print server is connected to a remote machine, but having trouble with the remote part... I'm using System.Printing and passing in the remote hostname/IP address through the 'compID' variable. The problem I'm having is that the code always returns the networked printers on my LOCAL machine rather than the remote machine: EnumeratedPrintQueueTypes[] compEnumerationFlags = { EnumeratedPrintQueueTypes.Connections }; PrintServer

PrintQueueStatus returns None, printer is already turned off

与世无争的帅哥 提交于 2019-12-12 20:49:32
问题 I already turned off the printer, and my code still returns None Here is my code try { printServer.Refresh(); PrintQueue printQueue = new PrintQueue(printServer, cmbPrinters.Text.Trim()); printQueue.Refresh(); if (printQueue.QueueStatus == PrintQueueStatus.Offline) { MessageBox.Show("Offline"); } else if (printQueue.QueueStatus == PrintQueueStatus.None) { MessageBox.Show("None"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } I am expecting that it should return offline because I

Sending file to print not working using System.Drawing.Printing

三世轮回 提交于 2019-12-12 01:22:39
问题 I'm trying to send a file to print without opening it trough Adobe as suggested by several Answers here; instead, I'm using the PrintQueue library (from System.Drawing.Printing ). What I've accomplished so far: I have the correct PrintQueue referenced as pq: PrintQueue pq; //Assume it's correct. The way to get here it isn't easy and it is not needed for the question. // Call AddJob PrintSystemJobInfo myPrintJob = pq.AddJob(); // Write a Byte buffer to the JobStream and close the stream Stream

Events in PrintQueue

妖精的绣舞 提交于 2019-12-08 08:21:09
问题 ps = new PrintServer(printserverName); PrintQueue pq1 = new PrintQueue(ps, pq.Name); As per my understanding, pq1 is a printer Queue which will handle print jobs. I want to catch events for this print queue. For example, if user A gives a print then this print job is added into the queue.I want to catch this job added into the queue event.So, I can know how many pages are allowed to user or validating the user. 回答1: As I understand it, ou can handle your OWN print queues (AddJob for example .

Events in PrintQueue

落爺英雄遲暮 提交于 2019-12-08 04:11:16
ps = new PrintServer(printserverName); PrintQueue pq1 = new PrintQueue(ps, pq.Name); As per my understanding, pq1 is a printer Queue which will handle print jobs. I want to catch events for this print queue. For example, if user A gives a print then this print job is added into the queue.I want to catch this job added into the queue event.So, I can know how many pages are allowed to user or validating the user. As I understand it, ou can handle your OWN print queues (AddJob for example ..) but you cannot intercept the printjobs of other users. Looks like at the win32 API level you have an

Access Denied trying to purge printqueue in C#

那年仲夏 提交于 2019-12-06 01:11:34
问题 I'm trying to make a method in C# that empties all items in a print queue. Below is my code: LocalPrintServer localPrintServer = new LocalPrintServer(PrintSystemDesiredAccess.AdministratePrinter); PrintQueue printQueue = localPrintServer.GetPrintQueue(printerName); if (printQueue.NumberOfJobs > 0) { printQueue.Purge(); } When this code runs, on the localPrintServer constructor, the app throws this error: "An exception occurred while creating the PrintServer object. Win32 error: Access is

Access Denied trying to purge printqueue in C#

天涯浪子 提交于 2019-12-04 04:02:00
I'm trying to make a method in C# that empties all items in a print queue. Below is my code: LocalPrintServer localPrintServer = new LocalPrintServer(PrintSystemDesiredAccess.AdministratePrinter); PrintQueue printQueue = localPrintServer.GetPrintQueue(printerName); if (printQueue.NumberOfJobs > 0) { printQueue.Purge(); } When this code runs, on the localPrintServer constructor, the app throws this error: "An exception occurred while creating the PrintServer object. Win32 error: Access is denied." That constructor has a few overloads (including sending no parameters). Trying any of those, I get

How to pause the Win32_printJob by Printername and JobID

白昼怎懂夜的黑 提交于 2019-11-29 12:27:29
TASK When user print the document ,pause the pop will appear then fill the form click enter the form will closed and job has been resumed. We have 50 Network Printers , 2000 Client Machine and one print server . EACH CLIENT had 3 or 4 printers PROBLEM If user print the document locally (EX:PDF PRINTER, XPS DOCUMENT WRITER) (or) using network printer (CANON,HP) the print-job was immediately PAUSE. MY TRIES When print any of the document the event listener watching and return the print job . In First Pause Method sometimes work and mostof time doesn't work properly.Because, Its searching for the