Creating a PDF file with ghostscript, redmon and a virtual postscript printer


I have been reading about creating pdf files using ghostscript, redmon and a post-script printer.  Does anyone how to put all three of these together?  People seem to be saying that the steps are:
1) install ghostscript
2) install redmon
3) setup a virtual printer (postscript with the out being redirect by redmon to a custom exe)
4) whenever you would like a pdf document just print to the virtual printer

The custom exe takes the postscript printer's output and coverts it into pdf via ghostscript.  

Basically I need to create a pdf document based on MS Word documents.  Since the user will be creating the files in Word, I was hoping to print the document to the virtual printer, timestamp it and place it into a protected directory (all through code).  This would save a great deal of time for them.    

So does anyone have a site, insight or code that does the custom exe part?  Unfortunately, I have no idea how to work with printer spools or whatever is at work here.  I can't use any of the free pdf printer driver applications since they all require the user to give a file name or set some other settings (for example that comes with C++ source code).

Hopefully some can help out, but thanks for reading, participating and maybe helping.

PS: If someone has a solution with full code, I would be more than willing to double the points or maybe pay a little through paypal (if it is allowed).

Some links of relevance: (free source code available in C++)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is an open source GNU General Public License (GPL)  project called PDFCreator which is written in VB and does what you want.

Also worth a look is CutePDF which is free an allows you to save any windows document that can be printed, including MS-Word documents, as a PDF file.
keeplivingAuthor Commented:
Hi JR2003,

I saw that project as well as the iText ones and was worried about the number of bugs those one had.  Seeing that the other programs due the redmon trick, I thought it might be safer than what these guys are doing.  Was this incorrect thinking?

CutePDF will not allow me to programmatically set the parameters for file name and such without buying the more expensive licensing.  It is very much like pdf995 or primopdf in these terms.

Thanks for the reply and suggest.
I think it will be a great deal lot of effort to write something like that yourself and printer drivers are notoriously difficult to debug. I think you will save money, time and a lot of headaches if you just buy one of the licences that allows royalty free distribution. The license is then only a one off  cost.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

keeplivingAuthor Commented:

I downloaded the source for PDFCreator and have started to take a closer look at it.  It is a lot of work that they have put in!    

A printer spooler and properties window with lotz of settings associated to the output.  Very impressive actually in terms of the amount of functionality work they have put into.  Yet they still use redmon.  I might be taking on too much here.  I can't do this type of coding.

Regarding, licensing an existing product.  That just would not be possible.  The usual story, either make it work and get little recognition or don't and have the end user complain and moan for the extra steps they have to go through until it is finally ignored or dropped. Not complaining, just the usual story.

Thanks for the feedback, I guess I am hoping that someone has done this already or something.

If you intend on using this on a client then you can install a postscript printer, any will do I use an HP8100. Save the file with a '.ps' extension then run GhostScript on it.

I have some source for automating the GhostScript piece as well as here is the link to GhostScripts site with some examples of using the api -

It also wouldn't be that hard to set up a "watched folder" and run it all automaticaly if that is where you are headed.

keeplivingAuthor Commented:
Hi Ampapa,

The piece that puzzles me is how can I take the printer feed via RedMon and pass it into my vb app so that it will create the pdf file.  

The gsapi did not really go into how to use a virtual printer did it?  It looked more like how to call the ghostcript command lines for ps2pdf after a file has been printed to a ps file.  But what if someone prints two documents, one right after the first, wouldn't the ps file get overridden or have access denied or something?  Or am i completely lost?

I don't know about the watched folder idea, since I would rather pass the filename when I print to the virtual printer.  This way, I can do many print jobs one at a time and not worry about managing jobs that in the que or took longer to print then others.  Know what i mean?

Do you have some source as how to do this using Redmon?  If so, can i get it off of you at a reasonable price, please?

Thanks for replying.
I've got to tell you we use Distiller to convert .ps files to .PDF's but I think a watched folder might work for your purposes. In Redmon when setting up the port you set it to redired to the program "redfile.exe" which is part of Redmon and the arguments are "C:\temp\" and "allow the program to handle the output".

So, every time that you print using the Redmn port what you'll get is a file in the above directory incremented by Reportman with an extension of .ps. If using the watched directory concept ghostscript the .ps file when it appears or in our case we use Distiller due to the $100 minimal cost and I pass the newely created file to Distiller and distill it.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.