[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3326
  • Last Modified:

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

Hi,

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 www.primopdf.com 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:
http://www.cs.wisc.edu/~ghost/
http://www.cs.wisc.edu/~ghost/redmon/index.htm
http://www.primopdf.com/ (free source code available in C++)
http://kenchiro.tripod.com/howtoPDF.html
http://home.hccnet.nl/s.vd.palen/index.html

0
keepliving
Asked:
keepliving
  • 3
  • 2
  • 2
1 Solution
 
JR2003Commented:
There is an open source GNU General Public License (GPL)  project called PDFCreator which is written in VB and does what you want.
http://sourceforge.net/projects/pdfcreator/

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.
http://www.cutepdf.com/
0
 
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.
0
 
JR2003Commented:
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.
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
keeplivingAuthor Commented:
Hi,

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.

0
 
ampapaCommented:
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 - http://www.cs.wisc.edu/~ghost/doc/gsapi.htm

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.

ampapa,
0
 
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.
0
 
ampapaCommented:
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\%4d.ps" 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.

ampapa,
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now