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 reply to Re: Windows print driver by afoken
in thread Windows print driver by ksublondie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.