cancelling the print job while printing....

hi all
this is regarding the printer driver printing multiple copies.
since mine is a virtual printer (that generates images instead of paper
output), i am using the Win32 API CopyFile() to create copies of the image
that is saved.
Consider a situation, the user gave number of copies as 32000 and the
printer is creating copies, in the middle of this, if user cancels the job,
my current implementation doesnt stops the printout as its going in a simple
“for loop” from 1 to number of copies specified…

The question is… when the job is cancelled, what is needed to be done in
the printer code (usermode ) so that i am able to detect that the printouts
are not required.

Thankx in advance.

regards
Vaibhav



Daring ideas are like chessmen moved forward. They may be beaten, but they
may start a winning game.

The glory of the Self is beheld by a few, and a few describe it; a few
listen, but many without understanding. The Self of all beings, living
within the body, is eternal and cannot be harmed. Therefore, do not grieve.

hi
i am not very sure about the process in which the user presses cancel, in my
case the print processor is default of windows… does this print processor
broadcasts a message or sends a message specifically to the printer
driver…
if i am able to recieve some sort of indication from the spooler, i can then
change the course of printing according…
thanx
regards
vaibhav
----- Original Message -----
From:
To:
Sent: Friday, March 22, 2002 10:44 PM
Subject: RE: [ntdev] cancelling the print job while printing…

> why dont you send a IRP to your virtual printer driver saying cancel,
> set a global to false. then in your for loop;
>
> for (int i=0; i< g_numberOfCopies && !g_bCancel; i++)
> {
> …
> }
>
> when you get the irp saying cancel
> g_bCancel = TRUE;
>
>
> ---- Original Message ----
> From: xxxxx@newgen.co.in
> To: xxxxx@lists.osr.com,
> Subject: RE: [ntdev] cancelling the print job while printing…
> Date: Fri, 22 Mar 2002 12:48:34 +0530
>
> >hi all
> >this is regarding the printer driver printing multiple copies.
> >since mine is a virtual printer (that generates images instead of
> >paper
> >output), i am using the Win32 API CopyFile() to create copies of the
> >image
> >that is saved.
> >Consider a situation, the user gave number of copies as 32000 and
> >the
> >printer is creating copies, in the middle of this, if user cancels
> >the job,
> >my current implementation doesnt stops the printout as its going in
> >a simple
> >“for loop” from 1 to number of copies specified…
> >
> >The question is… when the job is cancelled, what is needed to be
> >done in
> >the printer code (usermode ) so that i am able to detect that the
> >printouts
> >are not required.
> >
> >Thankx in advance.
> >
> >regards
> >Vaibhav
> >
> >---------------------------------------------------------------------
> >-------
> >-----------------------------------
> >Daring ideas are like chessmen moved forward. They may be beaten,
> >but they
> >may start a winning game.
> >------------------------
> >The glory of the Self is beheld by a few, and a few describe it; a
> >few
> >listen, but many without understanding. The Self of all beings,
> >living
> >within the body, is eternal and cannot be harmed. Therefore, do not
> >grieve.
> >
> >
> >
> >—
> >You are currently subscribed to ntdev as: xxxxx@systemexposure.com
> >To unsubscribe send a blank email to %%email.unsub%%
> >
> Shane Parrish,
> System Exposure

Sanjeev
ya thats what i am doing… in general, the implementation of copies is in
the hands of driver if it wants to play the entire data again or not… from
the application point of view, the applications(like microsoft excel etc
create multiple print jobs of single copy each when multiple copies are
enabled… that too only when user checks the collate box.)
now coming back to the problem i am facing… is that in case of end page/or
enddoc i am checking for the copies, if multiple copies are enabled in
devmode i enter a loop and create replicas of original copy by win32api
CopyFile().
i want to know what happens if the user presses cancel from the spooler (
where the print job is still showing status as printing… )

is there any way to know when user click on cancel at this stage! so that i
can exit from the loop as soon as possible instead of creating all the
copies as desired earlier before start of printing.
regards
vaibhav
----- Original Message -----
From: “Sanjeev Tiwari”
To: “‘Vaibhav Kalia’”
Sent: Saturday, March 23, 2002 3:05 PM
Subject: RE: [ntdev] Re: cancelling the print job while printing…

> > > i am using the Win32 API CopyFile() to create copies of the image
> It appears that for multiple copies of the same document, the print
> processor and spooler etc are involved only for first copy, when you have
> the image of the first copy you use CopyFile() to generate remaining
copies.
> I don’t think in that case print processor or spooler is involved in
> printing other copies.
> How is the job cancelled? When it appears in the printer queue?
>
>
> -----Original Message-----
> From: Vaibhav Kalia [mailto:xxxxx@newgen.co.in]
> Sent: Saturday, March 23, 2002 9:40 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: cancelling the print job while printing…
>
>
> hi
> i am not very sure about the process in which the user presses cancel, in
my
> case the print processor is default of windows… does this print
processor
> broadcasts a message or sends a message specifically to the printer
> driver…
> if i am able to recieve some sort of indication from the spooler, i can
then
> change the course of printing according…
> thanx
> regards
> vaibhav
> ----- Original Message -----
> From:
> To:
> Sent: Friday, March 22, 2002 10:44 PM
> Subject: RE: [ntdev] cancelling the print job while printing…
>
>
> > why dont you send a IRP to your virtual printer driver saying cancel,
> > set a global to false. then in your for loop;
> >
> > for (int i=0; i< g_numberOfCopies && !g_bCancel; i++)
> > {
> > …
> > }
> >
> > when you get the irp saying cancel
> > g_bCancel = TRUE;
> >
> >
> > ---- Original Message ----
> > From: xxxxx@newgen.co.in
> > To: xxxxx@lists.osr.com,
> > Subject: RE: [ntdev] cancelling the print job while printing…
> > Date: Fri, 22 Mar 2002 12:48:34 +0530
> >
> > >hi all
> > >this is regarding the printer driver printing multiple copies.
> > >since mine is a virtual printer (that generates images instead of
> > >paper
> > >output), i am using the Win32 API CopyFile() to create copies of the
> > >image
> > >that is saved.
> > >Consider a situation, the user gave number of copies as 32000 and
> > >the
> > >printer is creating copies, in the middle of this, if user cancels
> > >the job,
> > >my current implementation doesnt stops the printout as its going in
> > >a simple
> > >“for loop” from 1 to number of copies specified…
> > >
> > >The question is… when the job is cancelled, what is needed to be
> > >done in
> > >the printer code (usermode ) so that i am able to detect that the
> > >printouts
> > >are not required.
> > >
> > >Thankx in advance.
> > >
> > >regards
> > >Vaibhav
> > >
> > >---------------------------------------------------------------------
> > >-------
> > >-----------------------------------
> > >Daring ideas are like chessmen moved forward. They may be beaten,
> > >but they
> > >may start a winning game.
> > >------------------------
> > >The glory of the Self is beheld by a few, and a few describe it; a
> > >few
> > >listen, but many without understanding. The Self of all beings,
> > >living
> > >within the body, is eternal and cannot be harmed. Therefore, do not
> > >grieve.
> > >
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: xxxxx@systemexposure.com
> > >To unsubscribe send a blank email to %%email.unsub%%
> > >
> > Shane Parrish,
> > System Exposure
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
> To unsubscribe send a blank email to %%email.unsub%%

Vaibhav,
I am using a Kernel Mode Graphics DLL, while it appears that
your Graphics DLL runs in Kernel mode. I treat multiple copies as multiple
print jobs, (it doesn’t make much sense for a Virtual Printer to print
multiple copies, except that you just want the virtual printer to appear as
a normal printer).
They GDI with the help of my virtual printer driver renders print jobs. It
is the responsibility of my Printer Driver to send the rendered image’s data
stream to the print spooler, Instead of doing that I save the image data in
a file. Thus I get images instead of printed pages.

In my case when the user cancel from the spooler ( where the print job is
still showing status as printing… ), I don’t have to do anything the
print processor stops giving the print jobs as soon as the user cancel them.
In your case does it shows the no. of copies it is printing??. If it shows
only a single print job, I doubt you will get any indication to cancel it.
As far as I understand It is the responsibilty of Print processor to cancel
printing jobs, but in your case since the print processor only gives one
print job, and you make multiple copies, print processor cannot cancel
printing.
I understand all this doesn’t solve your problem, but I hope it make the
picture a bit more clear.

Sanjeev

-----Original Message-----
From: Vaibhav Kalia [mailto:xxxxx@newgen.co.in]
Sent: Saturday, March 23, 2002 3:34 PM
To: NT Developers Interest List
Subject: [ntdev] Re: cancelling the print job while printing…

Sanjeev
ya thats what i am doing… in general, the implementation of copies is in
the hands of driver if it wants to play the entire data again or not… from
the application point of view, the applications(like microsoft excel etc
create multiple print jobs of single copy each when multiple copies are
enabled… that too only when user checks the collate box.)
now coming back to the problem i am facing… is that in case of end page/or
enddoc i am checking for the copies, if multiple copies are enabled in
devmode i enter a loop and create replicas of original copy by win32api
CopyFile().
i want to know what happens if the user presses cancel from the spooler (
where the print job is still showing status as printing… )

is there any way to know when user click on cancel at this stage! so that i
can exit from the loop as soon as possible instead of creating all the
copies as desired earlier before start of printing.
regards
vaibhav
----- Original Message -----
From: “Sanjeev Tiwari”
To: “‘Vaibhav Kalia’”
Sent: Saturday, March 23, 2002 3:05 PM
Subject: RE: [ntdev] Re: cancelling the print job while printing…

> > > i am using the Win32 API CopyFile() to create copies of the image
> It appears that for multiple copies of the same document, the print
> processor and spooler etc are involved only for first copy, when you have
> the image of the first copy you use CopyFile() to generate remaining
copies.
> I don’t think in that case print processor or spooler is involved in
> printing other copies.
> How is the job cancelled? When it appears in the printer queue?
>
>
> -----Original Message-----
> From: Vaibhav Kalia [mailto:xxxxx@newgen.co.in]
> Sent: Saturday, March 23, 2002 9:40 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: cancelling the print job while printing…
>
>
> hi
> i am not very sure about the process in which the user presses cancel, in
my
> case the print processor is default of windows… does this print
processor
> broadcasts a message or sends a message specifically to the printer
> driver…
> if i am able to recieve some sort of indication from the spooler, i can
then
> change the course of printing according…
> thanx
> regards
> vaibhav
> ----- Original Message -----
> From:
> To:
> Sent: Friday, March 22, 2002 10:44 PM
> Subject: RE: [ntdev] cancelling the print job while printing…
>
>
> > why dont you send a IRP to your virtual printer driver saying cancel,
> > set a global to false. then in your for loop;
> >
> > for (int i=0; i< g_numberOfCopies && !g_bCancel; i++)
> > {
> > …
> > }
> >
> > when you get the irp saying cancel
> > g_bCancel = TRUE;
> >
> >
> > ---- Original Message ----
> > From: xxxxx@newgen.co.in
> > To: xxxxx@lists.osr.com,
> > Subject: RE: [ntdev] cancelling the print job while printing…
> > Date: Fri, 22 Mar 2002 12:48:34 +0530
> >
> > >hi all
> > >this is regarding the printer driver printing multiple copies.
> > >since mine is a virtual printer (that generates images instead of
> > >paper
> > >output), i am using the Win32 API CopyFile() to create copies of the
> > >image
> > >that is saved.
> > >Consider a situation, the user gave number of copies as 32000 and
> > >the
> > >printer is creating copies, in the middle of this, if user cancels
> > >the job,
> > >my current implementation doesnt stops the printout as its going in
> > >a simple
> > >“for loop” from 1 to number of copies specified…
> > >
> > >The question is… when the job is cancelled, what is needed to be
> > >done in
> > >the printer code (usermode ) so that i am able to detect that the
> > >printouts
> > >are not required.
> > >
> > >Thankx in advance.
> > >
> > >regards
> > >Vaibhav
> > >
> > >---------------------------------------------------------------------
> > >-------
> > >-----------------------------------
> > >Daring ideas are like chessmen moved forward. They may be beaten,
> > >but they
> > >may start a winning game.
> > >------------------------
> > >The glory of the Self is beheld by a few, and a few describe it; a
> > >few
> > >listen, but many without understanding. The Self of all beings,
> > >living
> > >within the body, is eternal and cannot be harmed. Therefore, do not
> > >grieve.
> > >
> > >
> > >
> > >—
> > >You are currently subscribed to ntdev as: xxxxx@systemexposure.com
> > >To unsubscribe send a blank email to %%email.unsub%%
> > >
> > Shane Parrish,
> > System Exposure
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
> To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
To unsubscribe send a blank email to %%email.unsub%%

Sorry, I meant “your Graphics DLL runs in User mode”
sanjeev

-----Original Message-----
From: Sanjeev Tiwari [mailto:xxxxx@dcmtech.co.in]
Sent: Saturday, March 23, 2002 4:23 PM
To: NT Developers Interest List
Subject: [ntdev] Re: cancelling the print job while printing…

Vaibhav,
I am using a Kernel Mode Graphics DLL, while it appears that
your Graphics DLL runs in Kernel mode. I treat multiple copies as multiple
print jobs, (it doesn’t make much sense for a Virtual Printer to print
multiple copies, except that you just want the virtual printer to appear as
a normal printer).
They GDI with the help of my virtual printer driver renders print jobs. It
is the responsibility of my Printer Driver to send the rendered image’s data
stream to the print spooler, Instead of doing that I save the image data in
a file. Thus I get images instead of printed pages.

In my case when the user cancel from the spooler ( where the print job is
still showing status as printing… ), I don’t have to do anything the
print processor stops giving the print jobs as soon as the user cancel them.
In your case does it shows the no. of copies it is printing??. If it shows
only a single print job, I doubt you will get any indication to cancel it.
As far as I understand It is the responsibilty of Print processor to cancel
printing jobs, but in your case since the print processor only gives one
print job, and you make multiple copies, print processor cannot cancel
printing.
I understand all this doesn’t solve your problem, but I hope it make the
picture a bit more clear.

Sanjeev

Sanjeev
actually i have 2 dlls… one runs in kernel mode that does all the job of
rendering (DrvXXX functions implemented in it) and other is a user mode dll
that is actually implementation of all the DrvSplXXX functions…
i am trying to find a work around for the problem that is coming in usermode
dll…
& after your mail, what i analysed was that spooler is getting a single
print job…
and this means that some more R&D is required … :frowning:
anyway thanx for help… !!!
regards
vaibhav
----- Original Message -----
From: “Sanjeev Tiwari”
To: “NT Developers Interest List”
Sent: Saturday, March 23, 2002 4:38 PM
Subject: [ntdev] Re: cancelling the print job while printing…

> Sorry, I meant “your Graphics DLL runs in User mode”
> sanjeev
>
> -----Original Message-----
> From: Sanjeev Tiwari [mailto:xxxxx@dcmtech.co.in]
> Sent: Saturday, March 23, 2002 4:23 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: cancelling the print job while printing…
>
>
> Vaibhav,
> I am using a Kernel Mode Graphics DLL, while it appears that
> your Graphics DLL runs in Kernel mode. I treat multiple copies as multiple
> print jobs, (it doesn’t make much sense for a Virtual Printer to print
> multiple copies, except that you just want the virtual printer to appear
as
> a normal printer).
> They GDI with the help of my virtual printer driver renders print jobs. It
> is the responsibility of my Printer Driver to send the rendered image’s
data
> stream to the print spooler, Instead of doing that I save the image data
in
> a file. Thus I get images instead of printed pages.
>
> In my case when the user cancel from the spooler ( where the print job is
> still showing status as printing… ), I don’t have to do anything the
> print processor stops giving the print jobs as soon as the user cancel
them.
> In your case does it shows the no. of copies it is printing??. If it shows
> only a single print job, I doubt you will get any indication to cancel it.
> As far as I understand It is the responsibilty of Print processor to
cancel
> printing jobs, but in your case since the print processor only gives one
> print job, and you make multiple copies, print processor cannot cancel
> printing.
> I understand all this doesn’t solve your problem, but I hope it make the
> picture a bit more clear.
>
> Sanjeev
>
> —
> You are currently subscribed to ntdev as: xxxxx@newgen.co.in
> To unsubscribe send a blank email to %%email.unsub%%