RE: Is genprint print processor the right palce to insert a watermark ?

I now have a nearly working solution, however…

I am adding extra pages to the print job in hooked GDI calls and then
playing the pages in the print processor so that only original number of
pages are printed with the extra pages providing the watermarks. This is
OK, except…

  1. The print job now shows up in the queue as having more pages than it
    should.

  2. The print job status goes to “Printed - deleting” but the job never
    actually gets deleted.

I have tried printing blank pages afetr the end of the job using a
GdiStartPageEMF(SpoolFileHandle) || !GdiEndPageEMF(SpoolFileHandle, 0) loop
so that the job does appear to have printed all the pages but the status
still goes to “Printed - deleting”.

Are there any ways to:

a) Alter the physical number of pages that the job thinks it has. The n-up
printing gets handled somehow and has the actual physical pages, rather than
the logical page count.

b) Abort the job once a subset of the pages have been printed from the print
processor.

Thanks in advance for any help,

Richard Abraham

-----Original Message-----
From: Richard Abraham [mailto:xxxxx@amsjv.com]
Sent: 01 February 2005 20:12
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is genprint print processor the right palce to
insert a watermark ?

*** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

Thanks for the info Steve.

I was hoping to do this without getting involved in the printer driver
to keep the solution at as high a level as possible.

I think I have a solution hooking GDI calls and customising the genprint
print processor but it’ll need some more work to get it fully working
for all cases.

Any other suggestions would be welcome.

Steve Johnson wrote:

Abraham, Richard W wrote:

>I am trying to add a watermark page to all print jobs on our system,
printed
>on any printer. If necessary we can lock down the system to only allow
>access to certain printers but would prefer not to.

You might try implementing an interface dll and handling the
DOCUMENTEVENT_CREATEDCPOST event in DrvDocumentEvent. At that point,
you should be able to write the watermark directly into the DC before
anything else is written there.

I’ve done similar stuff before. All you need to do is replace the
printer driver’s “Configuration File” entry in the registry, load the
“real” interface dll in your DllMain and then forward all Dev/DrvXxx
calls to the “real” dll.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@amsjv.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

After much experiment and falling back to the original genprint I have
solved my jobs not ending problem. I had a typo in my code that meant my
call to GdiDeleteSpoolFileHandle was being passed the function that
contained the call instead of the spool file handle. Doh!!

The jobs are now printing OK with overlaid header and footer pages and the
jobs are being deleted.

My only problem now is that the Total Number of Pages on the print queue
is not correct, if anyone has any ideas on how to modify this they would be
welcome.

Richard Abraham

-----Original Message-----
From: Abraham, Richard W [mailto:xxxxx@amsjv.com]
Sent: 03 February 2005 11:17
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Is genprint print processor the right palce to
insert a watermark ?

I now have a nearly working solution, however…

I am adding extra pages to the print job in hooked GDI calls and then
playing the pages in the print processor so that only original number of
pages are printed with the extra pages providing the watermarks. This is
OK, except…

  1. The print job now shows up in the queue as having more pages than it
    should.

  2. The print job status goes to “Printed - deleting” but the job never
    actually gets deleted.

I have tried printing blank pages afetr the end of the job using a
GdiStartPageEMF(SpoolFileHandle) || !GdiEndPageEMF(SpoolFileHandle, 0) loop
so that the job does appear to have printed all the pages but the status
still goes to “Printed - deleting”.

Are there any ways to:

a) Alter the physical number of pages that the job thinks it has. The n-up
printing gets handled somehow and has the actual physical pages, rather than
the logical page count.

b) Abort the job once a subset of the pages have been printed from the print
processor.

Thanks in advance for any help,

Richard Abraham

-----Original Message-----
From: Richard Abraham [mailto:xxxxx@amsjv.com]
Sent: 01 February 2005 20:12
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is genprint print processor the right palce to
insert a watermark ?

*** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

Thanks for the info Steve.

I was hoping to do this without getting involved in the printer driver
to keep the solution at as high a level as possible.

I think I have a solution hooking GDI calls and customising the genprint
print processor but it’ll need some more work to get it fully working
for all cases.

Any other suggestions would be welcome.

Steve Johnson wrote:

Abraham, Richard W wrote:

>I am trying to add a watermark page to all print jobs on our system,
printed
>on any printer. If necessary we can lock down the system to only allow
>access to certain printers but would prefer not to.

You might try implementing an interface dll and handling the
DOCUMENTEVENT_CREATEDCPOST event in DrvDocumentEvent. At that point,
you should be able to write the watermark directly into the DC before
anything else is written there.

I’ve done similar stuff before. All you need to do is replace the
printer driver’s “Configuration File” entry in the registry, load the
“real” interface dll in your DllMain and then forward all Dev/DrvXxx
calls to the “real” dll.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@amsjv.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@amsjv.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************