Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I want to know how many pages printed for a task that is given to printer through programming using c++ or vc++.

Adding some more information:

yes the file types that my program sending are DOC and PDF. After printing i need to log the data in how many pages are printed for that file for that user.

Some time i will not send total file ,i will send some selected pages or text also.

All just i wanted is how many of pages printed for that job in C++/VC++.

Tanks in advance.
Posted
Updated 4-Mar-13 6:23am
v2
Comments
Richard MacCutchan 4-Mar-13 7:30am    
Do you mean a print file that your program is sending, or some other file?
y3ec255 4-Mar-13 12:21pm    
yes the file types that my program sending are DOC and PDF. After printing i need to log the data in how many pages are printed for that file for that user.

Some time i will not send total file ,i will send some selected pages or text also.

All just i wanted is how many of pages printed for that job in C++/VC++.
Richard MacCutchan 4-Mar-13 12:23pm    
Well if you are sending the file then you will know in advance how many pages are to be printed.
YvesDaoust 4-Mar-13 12:37pm    
How do you submit the documents for printing ? Only this "print handler" knows how many pages were requested per document.

1 solution

You can subscribe to Windows print spooler notification functions, as FindFirstPrinterChangeNotification, FindNextPrinterChangeNotification with interest of JOB_NOTIFY_FIELD_TOTAL_PAGES, JOB_NOTIFY_FIELD_PAGES_PRINTED. Or you can examine Windows logs for the same information, using OpenEventLog on Windows XP or EvtSubscribe on Vista and later. And you can do it from printing process.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900