Why DOCUMENTEVENT_ENDPAGE is not called?

Discussion in 'Windows Vista Drivers' started by Saurabh Aggrawal, Mar 22, 2005.

  1. 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
     
    Saurabh Aggrawal, Mar 22, 2005
    #1
    1. Advertisements

  2. Saurabh Aggrawal

    Naveen Guest

    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
     
    Naveen, Mar 23, 2005
    #2
    1. Advertisements

  3. 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
     
    Saurabh Aggrawal, Mar 24, 2005
    #3
  4. Saurabh Aggrawal

    vipin Guest

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

    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
     
    vipin, Mar 24, 2005
    #4
  5. Saurabh Aggrawal

    Naveen Guest

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

    Naveen
     
    Naveen, Mar 25, 2005
    #5
  6. Saurabh Aggrawal

    vipin Guest

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

     
    vipin, Mar 27, 2005
    #6
  7. 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
     
    Saurabh Aggrawal, Mar 30, 2005
    #7
  8. Saurabh Aggrawal

    vipin Guest

    BTW, it is not a microsoft problem. That is the way it is. It is documented,
    I feel in DDK.
     
    vipin, Apr 7, 2005
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.