[WinPrnDev] Re: Creating a Printer Driver

  • From: "Clinton Bessesen" <clinton@xxxxxxxxxxxxxx>
  • To: winprndev@xxxxxxxxxxxxx
  • Date: Thu, 8 Apr 2010 10:36:38 +0100

Hi Sam,
looking at your ghostscript section, you are accepting "stdin" and then
outputting to the first parameter "%1" ( this could be a tempname ), I'm
not sure how you've set Redmon at this stage..

Anyway, a portmonitor can be designed to output to a tempfile, or simply
through it out to a standard file mechanism "stdout". In the default case
of REDMON ( I'm no expert ), I'm assuming if you select "program handles
output" it will simply call the executable you specified and through
stdout at it. This would require you app to accept stdin as a file handle
and then create a temp.

Hope it helps!
Clinton
>
> Hi Clinton
> I was wondering if you have any other references because I am trying to
> get my head around what exactly does the port monitor pass the GhostScript
> exe because i thought it was a straight stdin of the PostScript file
> obviously I am wrong because according to my RedMon port settings I am
> passing :
> @c:\gs\gs8.11\pdfwrite.rsp -sOutputFile="%1" -c save pop -f -
> the first part is clearly calling the pdf creation script, the second is
> calling the postscript file maybe?
> To make things clearer I wrote a simple exe that saves everything given to
> it to a file and this is what i receive, am i understanding this
> incorrectly? Does the Port Monitor create temp file and Ghostscript
> somehow knows where this temp file is ?
> Any help would make this much clearer I am still combing through the
> mountain load of information held in the help files of both GhostScript
> and RedMon to no avail
>
> RegardsSam
>
>> Date: Wed, 7 Apr 2010 17:32:10 +0100
>> Subject: [WinPrnDev] Re: Creating a Printer Driver
>> From: clinton@xxxxxxxxxxxxxx
>> To: winprndev@xxxxxxxxxxxxx
>>
>> Hi Sam,
>> I wouldn't think this is an issue with Redmon, are you using "run as
>> User"
>> switch. It might be a permissions/environment problem.
>> why don't you try and redirect to a program, this program writes to a
>> temp
>> file c:\sam_temp\123dfre.tmp, see if this works.
>> Clinton
>> >
>> > Clinton
>> > It seems that RedMon isnt supported on windows 7, whats odd is that
>> the
>> > PDF is created fine but if i try to redirect to my custom exe it just
>> > produces an error. This means I will have to create my own redirect
>> port
>> > which is a bit of a shame seeing as the functionality i want is in
>> RedMon
>> > RegardsSam
>> >
>> > From: hussam_88@xxxxxxxxxxx
>> > To: winprndev@xxxxxxxxxxxxx
>> > Subject: [WinPrnDev] Re: Creating a Printer Driver
>> > Date: Wed, 7 Apr 2010 15:28:12 +0000
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Clinton
>> > Apologies i was guided to use .NET but I realise its better to use C,
>> what
>> > if i just write a simple WIN32 console program? that way if i provide
>> the
>> > exe with the install there wont be any need to for framework to be
>> > installed on client side.
>> > I am just in the process of redirecting to my exe but it seems to be
>> > locked because i am getting erors when i try to configure the port, im
>> > sure ill sort it out though.
>> > Question is what does RedMon pass to ghostScript? the PostScript file?
>> and
>> > I still have no idea if the document name can be produced?
>> > RegardsSam
>> >
>> >
>> >> Date: Wed, 7 Apr 2010 16:21:13 +0100
>> >> Subject: [WinPrnDev] Re: Creating a Printer Driver
>> >> From: clinton@xxxxxxxxxxxxxx
>> >> To: winprndev@xxxxxxxxxxxxx
>> >>
>> >> Hi Sam,
>> >> Sorry my mistake. So what's the reason for .NET if you prefer C/C++?
>> >> Ignore me just we have a thing going on here in the office where
>> >> everyone
>> >> who knows me knows my common phrase "I do C/C++ why do I need a
>> >> FrameWork
>> >> to do things", not that I have any issue with the FrameWork, just
>> never
>> >> needed it.. Makes perfect sense for VB.NET and C##, BUT I love
>> pointers.
>> >>
>> >> Anyway, going off topic again. You should be able to decipher this.
>> >> Briefly the API calls to programatically add drivers, portmonitors
>> etc
>> >> is
>> >> identical.
>> >> AND yes, instead of ghostscript, call your app and away you go. Are
>> you
>> >> sure you want your users to first have a FrameWork installed before
>> >> calling a simple program?
>> >>
>> >> Clinton
>> >>
>> >> >
>> >> > Clinton
>> >> > Thanks alot i will take a look at it, although I much prefer C to
>> VB.
>> >> You
>> >> > know how it is with us programmers if you love C you hate VB and
>> vice
>> >> > versa :)
>> >> > But I was just wondering, RedMon actually allows you to point to
>> which
>> >> exe
>> >> > you want to start with, so instead of reirecting to ghostscript i
>> >> should
>> >> > redirect to my .net app right? RegardsSam
>> >> >
>> >> >> Date: Wed, 7 Apr 2010 15:35:23 +0100
>> >> >> Subject: [WinPrnDev] Re: Creating a Printer Driver
>> >> >> From: clinton@xxxxxxxxxxxxxx
>> >> >> To: winprndev@xxxxxxxxxxxxx
>> >> >>
>> >> >> Hi Sam,
>> >> >> I think you are getting there.
>> >> >> The INF file is nothing more than a text configuration file used
>> by
>> >> the
>> >> >> "Windows Add printer" User Interface. Primarily you don't need to
>> >> rely
>> >> >> on
>> >> >> this and can install a printer driver, portmonitor automatically,
>> BUT
>> >> if
>> >> >> you wish users to add a printer manually then the .inf is the way
>> to
>> >> go.
>> >> >> It instructs the interface where files should be placed and what
>> name
>> >> to
>> >> >> give the driver file with all its dependancies.
>> >> >>
>> >> >> Lets see you prefer VB, I have found a VB source site that does
>> >> >> everything
>> >> >> you require. Welcome to the world of opensource..
>> >> >>
>> >> >> http://www.pdfforge.org/download ( download the source and away
>> you
>> >> go )
>> >> >> The will install a printer driver, portmonitor, ghostscript. You
>> >> might
>> >> >> want to do things differently BUT I thought the language syntax
>> would
>> >> be
>> >> >> familiar so would make more sense than me sending you C snippets.
>> >> >>
>> >> >> Have Fun!
>> >> >> Clinton
>> >> >> >
>> >> >> > Sorry everyone, just goes to show how new I am to all of this. I
>> >> >> assumed
>> >> >> > the INF file would be produced after compilation when  its just
>> a
>> >> >> simple
>> >> >> > text file containing information about the driver and tells
>> windows
>> >> to
>> >> >> > copy the drivers to the system directory
>> >> >> > I relise this because compiling the local port sample on WDK, it
>> >> >> produced
>> >> >> > DDLs
>> >> >> > but RedMon has its own setup, I am assuming that given the
>> RedMon
>> >> DDLs
>> >> >> i
>> >> >> > can easily write an INF file to install the ports, so I need to
>> >> >> actually
>> >> >> > manipulate the code to stdout to a .net application instead of
>> >> >> ghostscript
>> >> >> > which does the same thing as ghostscript (as in create a temp
>> file
>> >> >> then
>> >> >> > PDF) and then upload to server.
>> >> >> > If thats correct then im finally beginning to understand what i
>> >> need
>> >> >> to
>> >> >> > do, but there still the matter of the document name, how will I
>> get
>> >> >> it?
>> >> >> > Will the output RedMon produces contain the name of the document
>> >> >> > somewhere? Maybe GhostScript has a field for document name?
>> >> >> > RegardsSam
>> >> >> >
>> >> >> > From: hussam_88@xxxxxxxxxxx
>> >> >> > To: winprndev@xxxxxxxxxxxxx
>> >> >> > Subject: [WinPrnDev] Re: Creating a Printer Driver
>> >> >> > Date: Wed, 7 Apr 2010 11:21:35 +0000
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > Clinton
>> >> >> > Thank you for your email, I am just looking at the RedMon source
>> >> code,
>> >> >> I
>> >> >> > still have no idea how they produce the INF from the code but i
>> am
>> >> >> > assuming that to build an inf of a printer port I will have to
>> >> maybe
>> >> >> work
>> >> >> > with the WDK.
>> >> >> >
>> >> >> >
>> >> >> > I guess im just lost as to where to start with creating the
>> Port,
>> >> once
>> >> >> i
>> >> >> > compile the C Code for the port monitor would that create an inf
>> >> file?
>> >> >> >
>> >> >> > From what i understood in your email your advising that I write
>> a
>> >> >> bridge
>> >> >> > program that creates the temp file of the input(Stdin) that it
>> >> >> receives
>> >> >> > from RedMon and then call Ghostscript to create the PDF from the
>> >> temp
>> >> >> > file, and although Ghost script does this its better if I am in
>> >> >> control of
>> >> >> > this process incase of bugs or crashes.
>> >> >> > so the first thing i need to do is create the Redmon that would
>> >> >> redirect
>> >> >> > to my program instead of Ghostscript and although i know i can
>> just
>> >> do
>> >> >> > that via the configure in the port menu I would muh rather get
>> >> stuck
>> >> >> in!
>> >> >> > and start learning by playing around with it.
>> >> >> > how do i create the inf file for my new redirection port though?
>> >> >> > RegardsSam
>> >> >> >> Date: Wed, 7 Apr 2010 12:13:19 +0100
>> >> >> >> Subject: [WinPrnDev] Re: Creating a Printer Driver
>> >> >> >> From: clinton@xxxxxxxxxxxxxx
>> >> >> >> To: winprndev@xxxxxxxxxxxxx
>> >> >> >>
>> >> >> >> Hi Sam,
>> >> >> >> If I remember correctly. REDMON can output to stdout ( Program
>> >> >> handles
>> >> >> >> output ). So you would need to create a little app ( C would do
>> ),
>> >> >> that
>> >> >> >> accepts stdin, creates a TEMPFile and then calls Ghostscript to
>> >> >> create
>> >> >> >> the
>> >> >> >> PDF ( another Temp ). This then can be "remotely sent".
>> >> Technically
>> >> >> >> GhostScript can accept stdin stdout, BUT I do advise you
>> >> controlling
>> >> >> the
>> >> >> >> file creation ( if something goes wrong, you know where ) and
>> >> passing
>> >> >> >> these as parameters to the PDF driver type.
>> >> >> >>
>> >> >> >> Hope it helps!
>> >> >> >> Clinton
>> >> >> >> PS: I read in a previous email someone saying that Microsoft
>> were
>> >> >> trying
>> >> >> >> to remove sockets/ports, this I don't think will ever happen as
>> >> the
>> >> >> >> spooler CORE is designed around this also CLUSTERED PRINTING
>> only
>> >> >> >> support
>> >> >> >> TCP/IP printing ( which is socket based through ports )
>> >> >> >>
>> >> >> >> >
>> >> >> >> > That sounds like much neater. OK so the next step is to
>> >> actuallly
>> >> >> >> learn
>> >> >> >> > how Redmon works and modify it to launch a .Net application.
>> I
>> >> will
>> >> >> >> also
>> >> >> >> > need to learn how Ghostscript works and how to convert the
>> >> >> Postscript
>> >> >> >> file
>> >> >> >> > produced to PDF, but what about naming. Does the port monitor
>> >> know
>> >> >> the
>> >> >> >> > name of the document? or will it be overwritten?
>> >> >> >> > RegardsSam
>> >> >> >> >
>> >> >> >> >> Date: Wed, 7 Apr 2010 11:33:36 +0200
>> >> >> >> >> Subject: [WinPrnDev] Re: Creating a Printer Driver
>> >> >> >> >> From: jjflash@xxxxxxxxx
>> >> >> >> >> To: winprndev@xxxxxxxxxxxxx
>> >> >> >> >>
>> >> >> >> >> On Wed, Apr 7, 2010 at 11:29 AM, Sam Elamin
>> >> >> <hussam_88@xxxxxxxxxxx>
>> >> >> >> >> wrote:
>> >> >> >> >> > So what if I print to a redmon port (RE1) which will
>> redirect
>> >> to
>> >> >> >> >> ghostscript
>> >> >> >> >> > which produces the PDF, then print the PDF to RedMon Port
>> 2
>> >> >> (RE2)
>> >> >> >> and
>> >> >> >> >> the
>> >> >> >> >> > second port will print to a .NET application which was
>> >> created
>> >> >> >> soley
>> >> >> >> >> to
>> >> >> >> >> > upload a job.
>> >> >> >> >>
>> >> >> >> >> Or have RedMon Port 1 launch your .Net app that first spawns
>> >> >> >> >> GhostScript to do the conversion and next upload the result
>> >> >> >> somewhere?
>> >> >> >> >>
>> >> >> >> >> ;)
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> Rune
>> >> >> >> >> ---
>> >> >> >> >> 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
>> >> >> >> >
>> >> >> >> > _________________________________________________________________
>> >> >> >> > http://clk.atdmt.com/UKM/go/197222280/direct/01/
>> >> >> >> > 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
>> >> >> >
>> >> >> > Get a free e-mail account with Hotmail. Sign-up now.
>> >> >> > _________________________________________________________________
>> >> >> > http://clk.atdmt.com/UKM/go/195013117/direct/01/
>> >> >> > We want to hear all your funny, exciting and crazy Hotmail
>> stories.
>> >> >> 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
>> >> >
>> >> > _________________________________________________________________
>> >> > http://clk.atdmt.com/UKM/go/197222280/direct/01/
>> >> > 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
>> >
>> > Get a free e-mail account with Hotmail. Sign-up now.
>> > _________________________________________________________________
>> > http://clk.atdmt.com/UKM/go/195013117/direct/01/
>> > We want to hear all your funny, exciting and crazy Hotmail stories.
>> 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
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>


---
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: