print-spooler-api

PagesPrinted field of job_info_2 not reliable for hp printers on windows 7, value depends on print processor

心不动则不痛 提交于 2020-01-24 00:31:11
问题 PagesPrinted field of job_info_2 not reliable for hp printers on windows 7, value depends on print processor I'm developping a print monitor, and for hp printer PagesPrinted is not reliable et has wrong values 回答1: The print driver for your printer is apparently calling SetJob with incorrect page count values. There's probably nothing you can do about that. Therefore, the only way to get an accurate page count is to parse the print data stream and count the pages yourself. The printer in

Prevent User from Printing

喜夏-厌秋 提交于 2019-12-23 03:35:06
问题 I've created an application in .net to monitor jobs in the printer by using the DLL in the following reference : http://www.codeproject.com/Articles/51085/Monitor-jobs-in-a-printer-queue-NET?fid=1556859&select=4799234 my question is : how can i delay or prevent user from printing after he print for example 5 times a day ? Knowing that The print jobs will saved in the DB. I appreciate any help. 回答1: A fairly simply program could be written using the FindFirstPrinterChangeNotification function

PrintServerException - “…name is invalid” even though I can access the path from windows

依然范特西╮ 提交于 2019-12-13 06:14:30
问题 A line similar to the following threw the above exception: PrintServer ps = new PrintServer(@"\\prntsrv"); When I use "Run..." on Windows the address above does work and take me to the list of print jobs so why does the line of code not work? 回答1: Apparently, the address \\prntsrv was a DNS alias to \\prntserv and the PrintServer constructor was unable to deal with it. To get around this issue I used the following code (I could also use just the code in the catch block instead and it would

Printer spooler api number of copies

故事扮演 提交于 2019-12-12 05:36:55
问题 I really could use some help, this is a question that alot of people are asking on the internet. I have different setups, tried different ways of testing, it's very frustrating. First setup: local printers local running code print from pdf or notepad: SUCCES (number of copies are 2) print from word: FAILED (numberof copies is 1) Second setup: local printers that are shared local running code print from other computer to shared printers number of copies isalways 1 Sowhat is everyone missing?

FindNextPrinterChangeNotification returns NULL for ppPrinterNotifyInfo

故事扮演 提交于 2019-12-11 11:24:00
问题 I'm stuck on problem were I would like to ask for some help: I have the task to print some files of different types using ShellExecuteEx with the "print" verb and need to guarantee print order of all files. Therefore I use FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification to monitor the events PRINTER_CHANGE_ADD_JOB and PRINTER_CHANGE_DELETE_JOB using two different threads in the background which I start before calling ShellExecuteEx as I don't know anything about the

Print spooler job cancellation message or callback wanted

人走茶凉 提交于 2019-12-11 07:31:19
问题 Backgroud: I'm now trying to print via GDI Print API, and it looks like this: StartDoc(hDC,&docinfo) foreach page in page_buf StartPage(hDC) /* write the page to printer DC */ EndPage(hDC) EndDoc(hDC) The Problem: During printing there would be a notification area icon, and by clicking on it there would be a small window showing current printing jobs on a specified printer. By right-clicking on a printing job and choosing Cancel , a printing job shall be cancelled. But my application

Print Spooler has stopped in PrintManager

半城伤御伤魂 提交于 2019-12-11 05:19:55
问题 I am using PrintManager(when webview is loaded) as follow: PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE); PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter(jobName)); printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build()); When save button is clicked, HTML is saved as pdf. When this process is done very fast i.e. while preview is loading, getting the following exception "Unfortunately Print Spooler has stopped

Why do I get ERROR_ACCESS_DENIED attempting to open a specific job using OpenPrinter?

流过昼夜 提交于 2019-12-10 11:49:14
问题 According to undocprint given a job ID it should be possible to retrieve the spool file for the job using OpenPrinter and ReadPrinter by opening the printer using a string with format "PrinterName,Job xxxx". The MSDN documentation lists this method as well, though with an additional space after the comma "PrinterName, Job xxxx". Whenever I try to call this method from my test application (using either string format) I get ERROR_ACCESS_DENIED (Windows 8 x64). Why is this and what do I need to

How do I find the spool file for the job with a given ID even when spool file pooling is enabled?

房东的猫 提交于 2019-12-09 14:16:17
问题 I would like to copy the spool data for a given Windows print job to an arbitrary location on disk. I have the job ID of the print job from the Print Spooler API. I know this job has finished spooling. I know the job won't be deleted before I have time to complete whatever I need to do. If file pooling is disabled, I can do this by looking in the spool directory for the file with format "xxxxx.spl", where xxxxx is the 0-padded job ID. How can I do this if file pooling is enabled? I'd be

How to programmatically achieve editing of the spool file header of the normal windows print queue 'spool file' before it is sent to the printer?

孤街浪徒 提交于 2019-11-29 12:44:52
How to intercept and change the windows 7 print spool file (.SPL) to add some additional information in the header like '@PJL SET NAME="PainPoint" ' before this file is sent to the printer during the execution of the print job? The .SPL file partial extract from top is : %-12345X@PJL SET STRINGCODESET=UTF8 @PJL COMMENT DATE=02/08/2017 @PJL ENTER LANGUAGE=PCLXL ) HP-PCL XL;2;1;FXXPL2-1.0.0,WINNT-6.1,XPL2DRV-6.9.1.1 ?X???........ Nick Westgate Editing the spool file is obviously trivial. The trick is how to get access to the spool file. I can think of a few ways offhand: Pause the print job