Reputation: 83
Some process starts a print job and then tells me about it. At this point, using C++, I need to find out how many pages the current print job consists of so I can display a "Printing page X of Y" message. i.e. I'm trying to find out Y.
I'd be grateful if someone could point me in the right direction. I've got as far as doing some things with the printer, but just can't see where I can get this info from.
Thanks for any help.
Upvotes: 1
Views: 1000
Reputation: 5002
As you can see in this example here: https://support.microsoft.com/en-us/kb/158828
You ned to enumerate jobs in Print Queue, then you will get JOB_INFO_1
structure for each job.
When you do pJobInfo->TotalPages you will have TotalPages of each job in print queue.
So in example above, find this:
printf( "[%d] [%s]\n", pJobInfo[i].JobId, pJobInfo[i].pDocument );
and add this:
printf( "Total Pages: [%d]\n", pJobInfo[i].TotalPages );
and you will have total pages count.
Upvotes: 1