[WinPrnDev] Re: Creating a Printer Driver

  • From: garyp@xxxxxxxxxx
  • To: winprndev@xxxxxxxxxxxxx
  • Date: Wed, 31 Mar 2010 16:12:31 +0100

Dear Sam,
The port monitor can do a lot of things. Because you have access to the
print job (in XPS or PostScript for example) then you can either parse it to
determine the job properties (or not bother and do this on the server), or
you could throw up a dialog asking the user what properties they want and
then transmit those with the job (still in XPS or PostScript or maybe now in
PDF format) to the server.
Regards,
Gary
-----Original Message-----
From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
Sent: 31 March 2010 16:07
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Re: Creating a Printer Driver


Gary


Can the port monitor pass print job settings or can i write a port monitor
that checks a print job;s properties then maybe pass them to the server? 


Regards
Sam

> From: garyp@xxxxxxxxxx
> To: winprndev@xxxxxxxxxxxxx
> Subject: [WinPrnDev] Re: Creating a Printer Driver
> Date: Wed, 31 Mar 2010 16:04:40 +0100
> 
> Dear Sam,
> FILE is a port monitor. It's one of the default ports available under
> Windows, like LPT1. If you want to trigger an upload to server mechanism
> then you either need to create a separate watch process to monitor for
file
> creation, or write your own port monitor which is then triggered by the
> event of someone printing (much easier). As I said, unless you use one of
> the PDF driver technologies which creates PDF without going through the
> interim stage of PostScript (and I don't know of any free one of those)
then
> you'll have to follow Clinton's suggestion of using a PostScript driver
and
> a port monitor which converts it to a PDF file - e.g. distil through
> GhostScript - and which then uploads this to a server. Or the port monitor
> could just grab the PostScript file, upload it to the server, and instead
do
> the distillation to PDF on the server.
> The only real difference at the client side if you decide to use XPS
instead
> of PDF is that you can go direct to XPS for free without any interim
> process. The rest of the system, e.g. a port monitor, is the same. But
then
> this would be a Windows only solution (which I think you mentioned before
as
> not being a problem). Server side you've still got to address the problem
of
> programmatically printing and defining job settings such as paper size,
> mono, duplex etc. and this is much simpler (and free) to do with XPS than
> with PDF.
> Regards,
> Gary
> -----Original Message-----
> From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> Sent: 31 March 2010 14:12
> To: winprndev@xxxxxxxxxxxxx
> Subject: [WinPrnDev] Re: Creating a Printer Driver
> 
> 
> Gary
> 
> 
> Yes that is correct, howeverif i save to file using "FILE", wont i lose
all
> the original formatting? If its the port monitor that does the saving of
the
> output file (from what I understood from Rune's eail) then maybe I can
> design a port monitor that creates a PDF or XPS and then save it the
client.
> 
> 
> Then I would have the path and then as previosly stated I can use my .NET
> application to upload it and print it from the server?
> 
> 
> Wont that make things far much simpler? 
> 
> 
> Regards
> Sam
> 
> > From: garyp@xxxxxxxxxx
> > To: winprndev@xxxxxxxxxxxxx
> > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > Date: Wed, 31 Mar 2010 14:06:17 +0100
> > 
> > Dear Sam,
> > Ah, you mean the path to the Output file. But you can do this in Windows
> > anyway. One of the standard ports in Windows is FILE: (open the Port
> option
> > for any of your print queues and you can choose that) which will then
put
> up
> > a dialog asking where you want to save the resultant file. The format of
> > that file will of course depend upon what your driver generates (PCL,
> > PostScript, XPS etc.). If you don't want a prompt everytime then you can
> > create a new port in Windows, choose "Local port", and then type in a
path
> > to a file name. It'll keep getting overwritten each time you print to it
> > though.
> > Most print drivers that produce PDF (as you are referring to) are
usually
> > based around a PostScript driver, and they use a custom port monitor to
> grab
> > the PostScript output and distil this into PDF at which point they can
> > prompt you for a destination file. There are also "pure" PDF solutions
out
> > there that accept the GDI printed by the Windows application and they
> > generate PDF without going though the interim PostScript stage.
> > Regards,
> > Gary
> > -----Original Message-----
> > From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> > Sent: 31 March 2010 13:46
> > To: winprndev@xxxxxxxxxxxxx
> > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > 
> > 
> > Gary
> > 
> > 
> > Then it was a misunderstand and I appologise if my questions are getting
> > repetitve, maybe I did not phrase it properly. I understand that if a
> > document is printed to a print driver, the driver has no idea what the
> > source is.
> > 
> > 
> > What I am asking about is a driver that creates a PDF document from
> anything
> > that is printed to it, so you would print a PPT power point document and
> the
> > output would be a PDF of the PPT. 
> > 
> > 
> > Wont the driver know where its supposed to save the output pdf and hence
> has
> > the PATH?
> > 
> > 
> > Regards
> > Sam
> > 
> > > From: garyp@xxxxxxxxxx
> > > To: winprndev@xxxxxxxxxxxxx
> > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > Date: Wed, 31 Mar 2010 13:01:22 +0100
> > > 
> > > Dear Sam,
> > > You're like a dog with a new bone! As a previous respondent said, the
> > > printer driver is just given a bunch of drawing commands, text etc. It
> > then
> > > renders those drawing commands into a language that the printer can
> > > understand. The printer driver knows nothing of "documents". It would
be
> > > like looking at a piece of printed paper and knowing from that the
path
> to
> > > the original Word document that it came from. There is no relational
> link
> > > between the source document and the output print job. Please don't
think
> > > that PDF or XPS or EMF or anything else would make any difference! The
> > only
> > > thing that knows the path to the original document is - somewhat
> obviously
> > -
> > > the application that handles it.
> > > Regards,
> > > Gary
> > > -----Original Message-----
> > > From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> > > Sent: 31 March 2010 12:25
> > > To: winprndev@xxxxxxxxxxxxx
> > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > 
> > > 
> > > Gary
> > > 
> > > 
> > > I thought so, thanks. But quick question arent there PDF print drivers
> > that
> > > will create a pdf of any document printed to it. Which means the
driver
> > > knows which path its creating the document to, correct?
> > > 
> > > 
> > > 
> > > 
> > > Regards
> > > Sam
> > > 
> > > > From: garyp@xxxxxxxxxx
> > > > To: winprndev@xxxxxxxxxxxxx
> > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > Date: Wed, 31 Mar 2010 12:15:34 +0100
> > > > 
> > > > Dear Sam,
> > > > That's about the long and the short of it, yes.
> > > > Regards,
> > > > Gary
> > > > -----Original Message-----
> > > > From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> > > > Sent: 31 March 2010 12:12
> > > > To: winprndev@xxxxxxxxxxxxx
> > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > 
> > > > 
> > > > Gary
> > > > 
> > > > 
> > > > So the bulk of the work will be developing the port monitor. Once
that
> > is
> > > > done we can then look at the "print ticket" which passes the right
> > > > properties.
> > > > 
> > > > 
> > > > To put it simply my custom print monitor will upload the XPS file
> which
> > > will
> > > > probably contain the print ticket (where the properties are held)
and
> > then
> > > > the server handles the job.
> > > > 
> > > > 
> > > > Regards
> > > > Sam
> > > > 
> > > > > From: garyp@xxxxxxxxxx
> > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > Date: Wed, 31 Mar 2010 12:07:50 +0100
> > > > > 
> > > > > Dear Sam,
> > > > > "what i need to do is develop a port monitor that can transfer
that
> > file
> > > > up
> > > > > to the server?." - yes.
> > > > > "Since the document has already been printed I wont need to supply
> the
> > > job
> > > > > properties (Color,Mono)." - this depends upon what options you
offer
> > in
> > > > your
> > > > > XPS "printer" driver, and which of those choices the user chooses.
> As
> > > with
> > > > > any printer.
> > > > > "is the XPS file i am sending a spool file and not an actual
> document
> > > like
> > > > a
> > > > > pdf? " - well the simple answer is that it's both. Read up on the
> XPS
> > > > > documentation. The feature you are looking for regarding colour
etc.
> > is
> > > in
> > > > > the Print Ticket which you can pass to the API for printing your
XPS
> > > file
> > > > on
> > > > > the server - subject to the PrintCapabilities of the printer
you're
> > > trying
> > > > > to send it to of course.
> > > > > Regards,
> > > > > Gary
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> > > > > Sent: 31 March 2010 12:01
> > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > 
> > > > > 
> > > > > Gary
> > > > > 
> > > > > 
> > > > > So what your saying is the XPS driver will provide me with the
file,
> > > what
> > > > i
> > > > > need to do is develop a port monitor that can transfer that file
up
> to
> > > the
> > > > > server?. Since the document has already been printed I wont need
to
> > > supply
> > > > > the job properties (Color,Mono).
> > > > > 
> > > > > 
> > > > > But what if i am printing a document which has colour in it to my
> XPS
> > > > > driver, and i choose to print in mono, then technically the XPS
file
> > > > > produced wont have any colour on it right? and where will the
other
> > data
> > > > be
> > > > > stored (Duplex or a4 or a3) or is the XPS file i am sending a
spool
> > file
> > > > and
> > > > > not an actual document like a pdf? 
> > > > > 
> > > > > 
> > > > > Regards
> > > > > Sam
> > > > > 
> > > > > > From: garyp@xxxxxxxxxx
> > > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > > Date: Wed, 31 Mar 2010 11:54:06 +0100
> > > > > > 
> > > > > > Dear Sam,
> > > > > > For the overwhelming majority of devices you cannot just send
them
> > XPS
> > > -
> > > > > > they don't understand it. But using an XPS print driver will
> provide
> > > you
> > > > > > with a file that has all the resources required to print that
job
> at
> > > the
> > > > > > server end (check out MSDN for how to submit XPS to a device
with
> > the
> > > > > > settings you are after). There is no need to convert XPS to PDF
by
> > the
> > > > > way,
> > > > > > it's completely unnecessary. You are correct about the mechanism
> for
> > > > > > replaying a metafile but I wouldn't recommend EMF because better
> > > > > > technologies are available (i.e. PDF or XPS) that address the
font
> > and
> > > > > file
> > > > > > size implications.
> > > > > > A port monitor is just a port, the same as printing to LPT1, or
> > COM1,
> > > or
> > > > a
> > > > > > file, or port 9100 on an IP address. In your case it's a bit of
> code
> > > > that
> > > > > > you want to run as the (XPS) file spools off the queue in order
to
> > > > trigger
> > > > > > your client / server communication. It's completely independent
of
> > > your
> > > > > > driver. Google "RedMon" for an example of one.
> > > > > > Regards,
> > > > > > Gary
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Sam Elamin [mailto:hussam_88@xxxxxxxxxxx]
> > > > > > Sent: 31 March 2010 10:45
> > > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > > 
> > > > > > 
> > > > > > Jason/Gary
> > > > > > 
> > > > > > 
> > > > > > Thanks Jason I got the sample working, now I am trying to
> understand
> > > > what
> > > > > a
> > > > > > port monitor is and how to implement it into the sample driver
> > > > > > 
> > > > > > 
> > > > > > Gary thank you for your detailed email and I understand your
> > concerns.
> > > 
> > > > > > 
> > > > > > 
> > > > > > But what i dont get is the print driver that will sit on the
> client
> > > > side,
> > > > > if
> > > > > > it converts documents to XPS then the print driver compatibility
> is
> > > not
> > > > > > really an issue because XPS can be understood by most printers
> > right?
> > > > > > 
> > > > > > 
> > > > > > and if its not why not use an XPS to PDF converter then print it
> at
> > > the
> > > > > > server. 
> > > > > > 
> > > > > > 
> > > > > > The question is when you print it how do you know what
properties
> to
> > > > give
> > > > > it
> > > > > > ( Color, Mono, Duplex, Simplex, etc) I am assuming there will be
> no
> > > > > printing
> > > > > > done at the client side so no spool file is generated.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > But if we go down the EMF route, then printing will be done, a
> spool
> > > > file
> > > > > > will be generated and then the EMF will be extracted from that
> spool
> > > > file.
> > > > > > 
> > > > > > 
> > > > > > The EMF then has to be transfered to a print server where it
will
> be
> > > > > played
> > > > > > back into a spool file so it can be printed.
> > > > > > 
> > > > > > 
> > > > > > Does that seem right? 
> > > > > > 
> > > > > > 
> > > > > > Regards
> > > > > > Sam
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: jharrison@xxxxxxxxxxx
> > > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > > Date: Tue, 30 Mar 2010 09:44:50 -0700
> > > > > > 
> > > > > > 
> > > > > > Hey Sam,
> > > > > > 
> > > > > > With the WDK 7600 there is an XPS printer sample, and much older
> > port
> > > > > > monitor sample. The harder part is connecting them and
installing
> > > them.
> > > > > > But all of the code is there and I believe working.
> > > > > > 
> > > > > > -Jason
> > > > > > 
> > > > > > --
> > > > > > Jason Harrison
> > > > > > Sr Software Developer
> > > > > > PDFTron Systems, Inc.
> > > > > > www.pdftron.com
> > > > > > Tel: 1-604-730-8989
> > > > > > Fax: 1-604-676-2477
> > > > > > Email: jharrison@xxxxxxxxxxx
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > CONFIDENTIALITY NOTICE: This message (and any attachment to it)
is
> > > > > intended
> > > > > > only for the use of the individual or entity to which it is
> > addressed
> > > in
> > > > > the
> > > > > > header, and may contain information that is privileged,
> confidential
> > > and
> > > > > > exempt from disclosure under applicable law. Any reproduction,
> > > > > distribution,
> > > > > > modification or use of the contents of this message (and any
> > > attachment
> > > > to
> > > > > > it) by any individual or entity other than the intended
recipient
> is
> > > > > > prohibited. If you have received this communication in error,
> please
> > > > > notify
> > > > > > us immediately and delete the original.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > P Please think before you print!
> > > > > > 
> > > > > > From: winprndev-bounce@xxxxxxxxxxxxx
> > > > > [mailto:winprndev-bounce@xxxxxxxxxxxxx]
> > > > > > On Behalf Of Sam Elamin
> > > > > > Sent: Tuesday, March 30, 2010 4:55 AM
> > > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > > 
> > > > > > Hey Clinton
> > > > > > 
> > > > > > Sorry for the late reply but Iw as rebuilding my PC with Windows
7
> > > > because
> > > > > I
> > > > > > heard that it is better as a printer driver building enviroment.

> > > > > > 
> > > > > > I have read your email and have a few questions:
> > > > > > 
> > > > > > 1) Did you use WDK to develop your driver? Did you write your
> driver
> > > > > > yourself?
> > > > > > 
> > > > > > 2) How do I start devloping this PostScript parser? and since
its
> > > > > Postscript
> > > > > > does it mean that I wont be ableto print to PCL drivers? Or
> > > > willconverting
> > > > > > it to PDF do the trick?
> > > > > > 
> > > > > > 3) I have no idea what you mean by using Port monitors, is there
> any
> > > > > > reference I can go back to and learn from?
> > > > > > 
> > > > > > 4) I think for testing purposes we might have to assume no
errors
> > and
> > > > get
> > > > > > the actual driver working before installing checks to look for
> > errors
> > > > > > 
> > > > > > I just feel really lost and overwhelmed, where is the best place
> to
> > > > start?
> > > > > > 
> > > > > > Regards
> > > > > > Sam
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: clinton@xxxxxxxxxxxxxx
> > > > > > To: winprndev@xxxxxxxxxxxxx
> > > > > > Subject: [WinPrnDev] Re: Creating a Printer Driver
> > > > > > Date: Sun, 28 Mar 2010 10:32:58 +0100
> > > > > > Hi Sam,
> > > > > > I'm doing this off the tail end of what seems like a long
> > discussion.
> > > > > > Not sure if you have your answer yet but might have a few design
> > ideas
> > > > for
> > > > > > you.
> > > > > > What you are trying to achieve has been done before and is
> possible.
> > > > > > Back in 2002 I was faced with a similar issue. Getting a
document
> > off
> > > > the
> > > > > > client PC and sending it round the world to an unknown print
> server.
> > > > > > The solution is a combination of technologies that each do their
> own
> > > > > part..
> > > > > > 
> > > > > > 1.) I used a PostScript print driver ( Generic PPD will do the
job
> )
> > > > that
> > > > > > pass the print stream onto a portmonitor ( this gives you the
> > control
> > > to
> > > > > > assign to random filename and pass onto the next module either
> > > > WebService
> > > > > or
> > > > > > in my case a socket service client ). 
> > > > > > 
> > > > > > THINGS TO REMEMBER:
> > > > > > If you are to allow for duplex, orientation, colour etc, then
you
> > will
> > > > > need
> > > > > > to gather this info and "drag" it along. I developed a
PostScript
> > > parser
> > > > > > that drives through the spool file ( PostScript ) extracts these
> > bits
> > > > and
> > > > > > then passes this with the file along ( make use of network
sockets
> > and
> > > > > send
> > > > > > as parameters or HASH index - a WenService or Socket listener
> would
> > > need
> > > > > to
> > > > > > manage these parameters ). OR in the world of WebServices pass
> over
> > an
> > > > XML
> > > > > > stream that can be managed.
> > > > > > 
> > > > > > On the "Server" side either convert to a generic format i.e. PDF
> > which
> > > > > then
> > > > > > can be converted over to MOST printer specific languages
> > > > > > 
> > > > > > 2.) Develop a portmonitor that manages the spoolfile and
controls
> > > > calling
> > > > > > the "service client" either webservice or sockets. Remember to
> > remove
> > > > the
> > > > > > file and close portinfo thus removing the JOB off the print
queue.
> > > > > > 
> > > > > > 3.) The bigest problem with transmitting data around is that we
> > forget
> > > > > about
> > > > > > the wonderful worl of TCP/IP packets and ERROR checking. What
> > happens
> > > if
> > > > > > network goes down during transmission, do I restart, fail,
notify
> > user
> > > > or
> > > > > > cycle through a number of socket trying to establish connection.
> > > > > > 
> > > > > > Hope this helps for starters.
> > > > > > Clinton Bessesen
> > > > > > check out www.pdqit.com
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Do you want a Hotmail account? Sign-up now - Free
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Do you have a story that started on Hotmail? Tell us now 
> > > > > > ---
> > > > > > Questions? First check the UndocPrint pages at
> > > > > http://www.undocprint.org/winspool
> > > > > > 
> > > > > > To unsubscribe, visit the List Server page at
> > > > > //www.freelists.org/list/winprndev
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Not got a Hotmail account? Sign-up now - Free 
> > > > > ---
> > > > > avast! Antivirus: Inbound message clean.
> > > > > Virus Database (VPS): 100331-0, 31/03/2010
> > > > > Tested on: 31/03/2010 12:03:15
> > > > > avast! - copyright (c) 1988-2010 ALWIL Software.
> > > > > http://www.avast.com
> > > > > ---
> > > > > Questions? First check the UndocPrint pages at
> > > > http://www.undocprint.org/winspool
> > > > > 
> > > > > To unsubscribe, visit the List Server page at
> > > > //www.freelists.org/list/winprndev
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Do you want a Hotmail account? Sign-up now - Free 
> > > > ---
> > > > avast! Antivirus: Inbound message clean.
> > > > Virus Database (VPS): 100331-0, 31/03/2010
> > > > Tested on: 31/03/2010 12:12:46
> > > > avast! - copyright (c) 1988-2010 ALWIL Software.
> > > > http://www.avast.com
> > > > ---
> > > > Questions? First check the UndocPrint pages at
> > > http://www.undocprint.org/winspool
> > > > 
> > > > To unsubscribe, visit the List Server page at
> > > //www.freelists.org/list/winprndev
> > > 
> > > 
> > > 
> > > 
> > > Got a cool Hotmail story? Tell us now 
> > > ---
> > > Questions? First check the UndocPrint pages at
> > http://www.undocprint.org/winspool
> > > 
> > > To unsubscribe, visit the List Server page at
> > //www.freelists.org/list/winprndev
> > 
> > 
> > 
> > 
> > Do you have a story that started on Hotmail? Tell us now 
> > ---
> > Questions? First check the UndocPrint pages at
> http://www.undocprint.org/winspool
> > 
> > To unsubscribe, visit the List Server page at
> //www.freelists.org/list/winprndev
> 
> 
> 
> 
> Not got a Hotmail account? Sign-up now - Free 
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 100331-1, 31/03/2010
> Tested on: 31/03/2010 14:13:27
> avast! - copyright (c) 1988-2010 ALWIL Software.
> http://www.avast.com
> ---
> Questions? First check the UndocPrint pages at
http://www.undocprint.org/winspool
> 
> To unsubscribe, visit the List Server page at
//www.freelists.org/list/winprndev




Do you want a Hotmail account? Sign-up now - Free 
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 100331-1, 31/03/2010
Tested on: 31/03/2010 16:08:52
avast! - copyright (c) 1988-2010 ALWIL Software.
http://www.avast.com
---
Questions? First check the UndocPrint pages at 
http://www.undocprint.org/winspool

To unsubscribe, visit the List Server page at 
//www.freelists.org/list/winprndev

Other related posts: