|
|
|
date: Thu, 5 Jun 2008 13:39:47 +0100,
group: microsoft.public.platformsdk.gdi
back
Printing Problem. GetJob, JOB_INFO_1, TotalPages
Hi
I have a project with C++ hooking of API calls and a customised printer
driver.
The purpose of these is 2 intercept users printing requests and
1. Pop up a dialog asking them to select a classification for their
document.
2. Record event to the event log saying userName, document title and
crucially, number of pages printed.
Background
I am having a problem recently discovered with '2'.
As part of our solution, in the hooking process, for every StartPage-EndPage
API call we receive, we print an extra page that has the classification
selected in a header and footer area on the extra page. Our custom print
driver then later on knows to merge every second page into the preceding
page thus giving us a printout with a classification on it.
When EndDoc is intercepted we then use the JOB_INFO_1 structure, TotalPages
member, returned by GetJob to see how many pages in total have gone out. We
then divide this by 2 because we know the driver is going to merge 2 into 1
and then log the event.
The problem.
During recent tests, printing one page, I have found that the TotalPages
member sometimes contains the value 0. When it does the JOB_INFO
PagesPrinted member then contains 2 (correctly).
Another time, the same test produces 2 in the TotalPages member and 0 in the
PagesPrinted member.
I tried to workaround this by checking both members and using the one that
didn't have the value 0. This seemed to work for a while.
However the real problem comes when printing "n-up" documents. Meaning
telling Word, Excel to print more than 1 page on a page. And this n-up can
be done in 2 different ways from the apps mentioned. firstly by letting
Word resize the pages to fit (Zoom: Pages per sheet), secondly by going into
the printer properties and setting the pages per sheet in that.
These then produce varied figures in both the PagesPrinted and the
TotalPages members. This meaning that I cannot accurately tell how many
pages have been printed.
Is there any way I can somehow make sure I get the exact number of pages
printed back correctly?
Thanks and hope that description makes sense. Please post if anything needs
further explanation. or info
KeithM
date: Thu, 5 Jun 2008 13:39:47 +0100
author: KeithM am
|
|