Hi,

I am writing the UI Plugin for the system driver for the 64 bit
operating system so that i could have watermark on the printed pages.

A printer UI-interface DLL's DrvDocumentEvent function can handle
certain events associated with printing a document. e.g
DOCUMENTEVENT_QUERYFILTER, DOCUMENTEVENT_ESCAPE,
DOCUMENTEVENT_STARTPAGE, DOCUMENTEVENT_ENDPAGE etc.

I have put the watermark rendering function on the
DOCUMENTEVENT_ENDPAGE event handler, which is the obvious choice.

HRESULT DocumentEvent(HANDLE hPrinter,HDC hDC,INT iEsc,ULONG cbIn,PVOID
pvIn,ULONG cbOut,PVOID pvOut,PINT piResult)
{

switch (iEsc)
{
case DOCUMENTEVENT_QUERYFILTER:{break;}

case DOCUMENTEVENT_ESCAPE:{break;}

case DOCUMENTEVENT_FIRST:{break;}

case DOCUMENTEVENT_ENDPAGE: {RenderWatermark(); break;}

return S_OK
}



The funtion DocumentEvent()( function in the UI-Plugin) is getting the
events to be handled from the DrvDocumentEvent() function of
winspool.drv

On the 32 bit operating system following sequence of events are called:

DOCUMENTEVENT_QUERYFILTER
DOCUMENTEVENT_FIRST
DOCUMENTEVENT_ESCAPE
DOCUMENTEVENT_ESCAPE
DOCUMENTEVENT_ESCAPE
DOCUMENTEVENT_ESCAPE
DOCUMENTEVENT_ENDPAGE


On the 64 bit system in am getting the events in the sequence:

DOCUMENTEVENT_QUERYFILTER
DOCUMENTEVENT_FIRST
DOCUMENTEVENT_QUERYFILTER
DOCUMENTEVENT_FIRST

since no DOCUMENTEVENT_ENDPAGE is called, the watermark is not printed.

My question is, why DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE
events are not called on the 64bit system?

Who is invoking these events in winspool.drv? My guess is SPOOLSS.DLL.


Regards,
Saurabh Aggrawal

RE: Why DOCUMENTEVENT_ENDPAGE is not called? by Naveen

Naveen
Tue Mar 22 22:35:02 CST 2005

Hi Saurabh,

DocumentEvent End Page comes very well in 64 bit. I dont see any problem in
that.

Looking to your code it seems you have not added EndPage in
DOCUMENTEVENT_QUERYFILTER.

Which should look something like the code below...If you have not added then
just add the escape you want to handle and update the feild cElementsReturned
by the number of escapes you want to add.

case DOCUMENTEVENT_QUERYFILTER:
{
VERBOSE(DLLTEXT("DOCUMENTEVENT_QUERYFILTER \r\n"));
if (pvOut)
{
DOCEVENT_FILTER * pFilter = (DOCEVENT_FILTER*)pvOut;
//pFilter->cElementsNeeded = 13;
pFilter->cElementsReturned = 13;
pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDPAGE;
pFilter->aDocEventCall[2] = DOCUMENTEVENT_ESCAPE;
pFilter->aDocEventCall[3] = DOCUMENTEVENT_ABORTDOC;
pFilter->aDocEventCall[4] = DOCUMENTEVENT_CREATEDCPOST;
pFilter->aDocEventCall[5] = DOCUMENTEVENT_CREATEDCPRE;
pFilter->aDocEventCall[6] = DOCUMENTEVENT_DELETEDC;
pFilter->aDocEventCall[7] = DOCUMENTEVENT_ENDDOCPOST;
pFilter->aDocEventCall[8] = DOCUMENTEVENT_ENDDOC;
pFilter->aDocEventCall[9] = DOCUMENTEVENT_RESETDCPOST;
pFilter->aDocEventCall[10] = DOCUMENTEVENT_STARTDOCPOST;
pFilter->aDocEventCall[11] = DOCUMENTEVENT_STARTDOC;
pFilter->aDocEventCall[12] = DOCUMENTEVENT_STARTPAGE;
*piResult = DOCUMENTEVENT_SUCCESS;
ret = S_OK;

}
else
{
*piResult = DOCUMENTEVENT_UNSUPPORTED;
ret = E_NOTIMPL;
}
break;
}

Thanks
Naveen

"Saurabh Aggrawal" wrote:

> Hi,
>
> I am writing the UI Plugin for the system driver for the 64 bit
> operating system so that i could have watermark on the printed pages.
>
> A printer UI-interface DLL's DrvDocumentEvent function can handle
> certain events associated with printing a document. e.g
> DOCUMENTEVENT_QUERYFILTER, DOCUMENTEVENT_ESCAPE,
> DOCUMENTEVENT_STARTPAGE, DOCUMENTEVENT_ENDPAGE etc.
>
> I have put the watermark rendering function on the
> DOCUMENTEVENT_ENDPAGE event handler, which is the obvious choice.
>
> HRESULT DocumentEvent(HANDLE hPrinter,HDC hDC,INT iEsc,ULONG cbIn,PVOID
> pvIn,ULONG cbOut,PVOID pvOut,PINT piResult)
> {
>
> switch (iEsc)
> {
> case DOCUMENTEVENT_QUERYFILTER:{break;}
>
> case DOCUMENTEVENT_ESCAPE:{break;}
>
> case DOCUMENTEVENT_FIRST:{break;}
>
> case DOCUMENTEVENT_ENDPAGE: {RenderWatermark(); break;}
>
> return S_OK
> }
>
>
>
> The funtion DocumentEvent()( function in the UI-Plugin) is getting the
> events to be handled from the DrvDocumentEvent() function of
> winspool.drv
>
> On the 32 bit operating system following sequence of events are called:
>
> DOCUMENTEVENT_QUERYFILTER
> DOCUMENTEVENT_FIRST
> DOCUMENTEVENT_ESCAPE
> DOCUMENTEVENT_ESCAPE
> DOCUMENTEVENT_ESCAPE
> DOCUMENTEVENT_ESCAPE
> DOCUMENTEVENT_ENDPAGE
>
>
> On the 64 bit system in am getting the events in the sequence:
>
> DOCUMENTEVENT_QUERYFILTER
> DOCUMENTEVENT_FIRST
> DOCUMENTEVENT_QUERYFILTER
> DOCUMENTEVENT_FIRST
>
> since no DOCUMENTEVENT_ENDPAGE is called, the watermark is not printed.
>
> My question is, why DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE
> events are not called on the 64bit system?
>
> Who is invoking these events in winspool.drv? My guess is SPOOLSS.DLL.
>
>
> Regards,
> Saurabh Aggrawal
>
>

Re: Why DOCUMENTEVENT_ENDPAGE is not called? by Saurabh

Saurabh
Thu Mar 24 02:30:07 CST 2005

Hi,
Yes it was a typing mistake, actually the code prototype is as follows:

case DOCUMENTEVENT_QUERYFILTER:
{
VERBOSE(DLLTEXT("DOCUMENTEVENT=AD=AD_QUERYFILTER \r\n"));
if (pvOut)
{
DOCEVENT_FILTER * pFilter =3D (DOCEVENT_FILTER*)pvOut;
pFilter->cElementsReturned =3D 2;
pFilter->aDocEventCall[0] =3D DOCUMENTEVENT_ENDPAGE;
pFilter->aDocEventCall[1] =3D DOCUMENTEVENT_ESCAPE;


*piResult =3D DOCUMENTEVENT_SUCCESS;


}
else
{
*piResult =3D DOCUMENTEVENT_UNSUPPORTED;
ret =3D E_NOTIMPL;
}
break;


I have tried the way you have suggested, but the problem is that the
events DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE are not comming
at all.
Yes the print processor is custom built.
Respects,
Saurabh Aggrawal


Re: Why DOCUMENTEVENT_ENDPAGE is not called? by vipin

vipin
Thu Mar 24 14:17:21 CST 2005

It won't come for banding drivers.
Hope it helps
Vipin

"Saurabh Aggrawal" <games60@hotmail.com> wrote in message
news:1111653007.209228.314590@g14g2000cwa.googlegroups.com...
Hi,
Yes it was a typing mistake, actually the code prototype is as follows:

case DOCUMENTEVENT_QUERYFILTER:
{
VERBOSE(DLLTEXT("DOCUMENTEVENT­­_QUERYFILTER \r\n"));
if (pvOut)
{
DOCEVENT_FILTER * pFilter = (DOCEVENT_FILTER*)pvOut;
pFilter->cElementsReturned = 2;
pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDPAGE;
pFilter->aDocEventCall[1] = DOCUMENTEVENT_ESCAPE;


*piResult = DOCUMENTEVENT_SUCCESS;


}
else
{
*piResult = DOCUMENTEVENT_UNSUPPORTED;
ret = E_NOTIMPL;
}
break;


I have tried the way you have suggested, but the problem is that the
events DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE are not comming
at all.
Yes the print processor is custom built.
Respects,
Saurabh Aggrawal



Re: Why DOCUMENTEVENT_ENDPAGE is not called? by Naveen

Naveen
Thu Mar 24 18:37:03 CST 2005

Yeah thats true. If you are trying with the GPD file supplied by DDK Sample
then these events will not come.

Naveen

"vipin" wrote:

> It won't come for banding drivers.
> Hope it helps
> Vipin
>
> "Saurabh Aggrawal" <games60@hotmail.com> wrote in message
> news:1111653007.209228.314590@g14g2000cwa.googlegroups.com...
> Hi,
> Yes it was a typing mistake, actually the code prototype is as follows:
>
> case DOCUMENTEVENT_QUERYFILTER:
> {
> VERBOSE(DLLTEXT("DOCUMENTEVENT­­_QUERYFILTER \r\n"));
> if (pvOut)
> {
> DOCEVENT_FILTER * pFilter = (DOCEVENT_FILTER*)pvOut;
> pFilter->cElementsReturned = 2;
> pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDPAGE;
> pFilter->aDocEventCall[1] = DOCUMENTEVENT_ESCAPE;
>
>
> *piResult = DOCUMENTEVENT_SUCCESS;
>
>
> }
> else
> {
> *piResult = DOCUMENTEVENT_UNSUPPORTED;
> ret = E_NOTIMPL;
> }
> break;
>
>
> I have tried the way you have suggested, but the problem is that the
> events DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE are not comming
> at all.
> Yes the print processor is custom built.
> Respects,
> Saurabh Aggrawal
>
>
>

Re: Why DOCUMENTEVENT_ENDPAGE is not called? by vipin

vipin
Sun Mar 27 03:18:09 CST 2005

not necessary, you can write a non-GPD based banding driver and it won't
come there also.

"Naveen" <Naveen@discussions.microsoft.com> wrote in message
news:0D574826-BF9E-4522-8D72-D077328F9522@microsoft.com...
> Yeah thats true. If you are trying with the GPD file supplied by DDK
> Sample
> then these events will not come.
>
> Naveen
>
> "vipin" wrote:
>
>> It won't come for banding drivers.
>> Hope it helps
>> Vipin
>>
>> "Saurabh Aggrawal" <games60@hotmail.com> wrote in message
>> news:1111653007.209228.314590@g14g2000cwa.googlegroups.com...
>> Hi,
>> Yes it was a typing mistake, actually the code prototype is as follows:
>>
>> case DOCUMENTEVENT_QUERYFILTER:
>> {
>> VERBOSE(DLLTEXT("DOCUMENTEVENT­­_QUERYFILTER \r\n"));
>> if (pvOut)
>> {
>> DOCEVENT_FILTER * pFilter = (DOCEVENT_FILTER*)pvOut;
>> pFilter->cElementsReturned = 2;
>> pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDPAGE;
>> pFilter->aDocEventCall[1] = DOCUMENTEVENT_ESCAPE;
>>
>>
>> *piResult = DOCUMENTEVENT_SUCCESS;
>>
>>
>> }
>> else
>> {
>> *piResult = DOCUMENTEVENT_UNSUPPORTED;
>> ret = E_NOTIMPL;
>> }
>> break;
>>
>>
>> I have tried the way you have suggested, but the problem is that the
>> events DOCUMENTEVENT_ESCAPE and DOCUMENTEVENT_ENDPAGE are not comming
>> at all.
>> Yes the print processor is custom built.
>> Respects,
>> Saurabh Aggrawal
>>
>>
>>



Re: Why DOCUMENTEVENT_ENDPAGE is not called? by Saurabh

Saurabh
Wed Mar 30 08:41:51 CST 2005

Hi,
You people are right.
For unidriver plug-ins Watermark doesnot work with Raster(PCL) for 24
Bpp. The reason is Unidriver bands in Raster for 24 Bpp and does not
send the DOCUMENTEVENT_ENDPAGE to plug-ins. I hope it will be fixed by
Microsoft in future.

Thanks,
Saurabh Aggrawal


Re: Why DOCUMENTEVENT_ENDPAGE is not called? by vipin

vipin
Wed Apr 06 22:48:36 CDT 2005

BTW, it is not a microsoft problem. That is the way it is. It is documented,
I feel in DDK.

"Saurabh Aggrawal" <games60@hotmail.com> wrote in message
news:1112193711.391908.160430@l41g2000cwc.googlegroups.com...
> Hi,
> You people are right.
> For unidriver plug-ins Watermark doesnot work with Raster(PCL) for 24
> Bpp. The reason is Unidriver bands in Raster for 24 Bpp and does not
> send the DOCUMENTEVENT_ENDPAGE to plug-ins. I hope it will be fixed by
> Microsoft in future.
>
> Thanks,
> Saurabh Aggrawal
>