[WinPrnDev] Re: Port monitors

  • From: "Christoph Lindemann" <Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx>
  • To: <winprndev@xxxxxxxxxxxxx>
  • Date: Thu, 2 Sep 2010 15:28:19 +0200

Hi Adam,

 

1)       If you want to modify the PDL, you could do this on the fly in
your port monitor

2)       If you need to make your changes depend on the source
application, you can not use a custom print processor for this. The only
thing that comes even close to the printing application, is the printer
driver (on some Windows versions). You might also need to look into
hooking/code-injection depending on which OS versions you need to
support. Also mixing 32bit and 64bit application, OS and drivers
presents some difficulties, where the thunking will isolate the
components from each other.

3)       By virtual printer, I mean your own virtual printer driver.
There are several OEM version which you can buy.

 

I also strongly suggest that you start reading and understanding the
whole WDK section on printer drivers and spooler components. That would
have helped answering a lot of your questions. Also playing around with
the WDK samples should give you some deeper understanding.

Additionally, try Google, there are other applications (even opensource)
that implement all or some parts of what you want.

 

/christoph

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of Adam Johnson
Sent: Thursday, September 02, 2010 2:37 PM
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Re: Port monitors

 

Hi,

 

I did not expect it to be easy no, you raise some interesting points
Christoph. Lets say I modify a job's PDL which is written is PS, where
exactly is this done? Because I edited the simple PS file but the
changes dont take effect. If i wanted to take into effect the
application it was sent from I will have to write my own print
processor.

 

Also by virtual printer do you mean write my own driver? If not then
what do you mean? A virtual printer that operates as an application? 

 

Regards

Adam

 

 

 

________________________________

Subject: [WinPrnDev] Re: Port monitors
Date: Thu, 2 Sep 2010 14:29:41 +0200
From: Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx
To: winprndev@xxxxxxxxxxxxx

Hi Adam,

 

1)       The port monitor does not know anything about the job content.
It only transports a stream of bytes.

2)       If you want to find out, from your port monitor, if duplex is
used, you need to parse the data stream. This data stream can be encoded
in one of many PDL (Page Description Language), depending on the driver.
This could be PCL, PostScript, Esc/P, Lavaflow, QPDL... in one of their
many incarnations and versions.

3)       The port monitor does not know anything about the source
application or the driver.

4)       If you want to change the options, you would need to parse the
job PDL and modify it or re-create/render the job using GDI.

5)       Depending on your needs, you could also look into:

a.       Creating a custom "print processor".

b.      Creating a custom "virtual printer", which would be the
interface between the user and your system

c.       Just buy one of the existing sollutions

 

Depending on the scope (supported OS versions, drivers, clustering...)
this is a major project, and "getting it right" requires massive
knowledge of Windows internals, spooler architecture, drivers... 

 

Have fun,

Christoph

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of Adam Johnson
Sent: Thursday, September 02, 2010 1:39 PM
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Re: Port monitors

 

Hi,

 

You are correct on point a, I would like to parse the print job to see
if duplex was selected. What is confusing me is how will the port
monitor know that duplex is selected or more importantly CAN it know?
surly the way duplex is selected ona n HP printer is different than
where its selected on a Xerox?

 

Or is it  that when one is selected the Port Monitor speaks directly to
windows so it doesn't matter what driver the job was spooled in?

 

My aim is to produce a port monitor that acts like an application, It
will parse the job and check its properties and if the properties are
not allowed change them. From Mono to colour and so on and so forth. I
know it cant be done because its spooled but what I can do is once the
job is spooled I will parse it using the port monitor and then if the
properties are not acceptable by a user's policy I will convert the PS
file to PDF and reprint it with the properties needed.

 

Also quick note it would be a good feature if i can police according to
job type so only print in Mono if its an email, can the port monitor
determine a print jobs original format? (.doc .pdf .html) and if not
then maybe the application the job was printed from ?

 

Regards

Adam

 

________________________________

Subject: [WinPrnDev] Re: Port monitors
Date: Thu, 2 Sep 2010 13:32:48 +0200
From: Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx
To: winprndev@xxxxxxxxxxxxx

Hi Adam,

 

It is not clear to me if you want to "query" the >print job< or the
physical printer, or like this:

a)       parse the print job to see if duplex was selected/used

b)      query the physical printer, if there is a duplex unit present in
the printer

 

Could you please elaborate a little more on this? Also feel free to tell
us more, about what you are ultimately trying to accomplish, might be
you are trying to tackle this problem in the wrong way.

 

/christoph

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of Adam Johnson
Sent: Thursday, September 02, 2010 1:17 PM
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Port monitors

 

Hello Experts.

 

I am experimenting with writing my own print driver which will enable
users to print to. My question is with many strange and wonderful print
drivers around, can I write my own Port monitor that will parse and
interrogate information given to the print driver.

 

For example if I am using a Ricoh print driver and a user clicks
"File,Print" it comes up with the Ricog print dialog, so if a user
clicks color and duplex. Is there any way the port monitor can verify
this? or interrogate the PS file to get job properties?

 

If so then what about the other more complex information like Collate?
Number of pages on the X and Y direction? Resolution (DPI) ?  To the
even more specific information that is device dependent like is staples
on?

 

I am trying to set up a policy enforcement program on the print server
but would like all users to print to one common printer, my port monitor
will then interrogate the print job properties and check it against the
database?

 

Is that remotely possible?

 

Regards

Adam

Other related posts: