Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Windows print driver

by afoken (Chancellor)
on Nov 11, 2015 at 07:30 UTC ( [id://1147418]=note: print w/replies, xml ) Need Help??


in reply to Windows print driver

In the old days, a friend told me about a trick to make a virtual printer emitting PDF files. It used Ghostscript for Windows, a "magic" ghostscript command line entered into a tool named RedMon. RedMon is still available, and it can do more than just starting Ghostscript and prompt for an output filename. It can be configured to run a program that will handle output on its own.

RedMon feeds the print job into STDIN of the program. The format depends on the printer driver used, typically you use some color postscript printer (some ancient Apple LaserWriter or the Ghostscript PDF driver distributed with Ghostscript). Additionally, some environment variables are set. Programs may write to STDOUT. This is quite similar to how CGI works.

It should be quite easy to create a wrapper for Ghostscript that forwards STDIN to Ghostscript, makes Ghostscript write a PDF to a temporary file (similar to PDF writer in the manual), and automatically uploads that temporary file to the server. Document name, user name and machine name are availabe in the environment (see above). The most interesting ones for you should be REDMON_DOCNAME, REDMON_USER, REDMON_MACHINE, REDMON_BASENAME. RedMon should start that wrapper instead of Ghostscript, configured as "program handles output". After the upload, the temp file should be deleted.

The users see just another printer with a catchy name like "Upload as PDF to the documents server". No questions asked. Perhaps the wrapper pops up a message box "Upload completed" after the job is done.

If the users may work offline, the wrapper needs to detect that and collect temp PDF files and all required environment variables for later upload. A second program should try to upload the temp files as soon as the user is back online.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Windows print driver
by ksublondie (Friar) on Nov 12, 2015 at 18:20 UTC
    That sounds just like the kind of sorcery they are asking for. I'll play with it and see if it will be feasible. Thanks for the information!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1147418]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2024-03-28 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found