Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Windows print driverby afoken (Chancellor) |
on Nov 11, 2015 at 07:30 UTC ( [id://1147418]=note: print w/replies, xml ) | Need Help?? |
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". ;-)
In Section
Seekers of Perl Wisdom
|
|