Using SwiftPublish with the Directory Monitor (hot folders)
 

SwiftPublish is a Windows application based on the Windows print subsystem.  It automates printing or conversion of any document type to pcl, pdf, tiff, PostScript, or HPGL.  SwiftPublish does this for files other than .pdf or .msg by looking up the “PrintTo” function associated by Windows with each input filetype, and invoking the registered application for that filetype to print to the SwiftPublish printer.  The SwiftPublish port monitor captures the print file and performs the configured action on the file, e.g. saving to a specified location and optionally running an output application on the file.

SwiftPublish includes DirMon, a Directory Monitor, "hot folders" NT service which can trigger a configured application when a file is written to a specified directory.  This utility can start a SwiftPublish or a SwiftConvert conversion.

Installation and Default DirMon Configuration

Use of SwiftPublish requires either an evaluation or a licensed copy of SwiftPublish.  To begin an evaluation, please refer to Getting Started Evaluating SwiftPublish.

The SwiftPublish evaluation installer adds 7 monitored directories under C:\Program Files\SwiftView:

converttopdf Convert any file viewable with SwiftView to a PDF file
converttotiff Convert any file viewable with SwiftView to a TIFF file
importtopcl Import any PDF file or Windows Document to a PCL file
importtopdf Import any PDF file or Windows Document to a PDF file
importtotiff Import any PDF file or Windows Document to a TIFF file
testlicense Show your SwiftConvert licensing for the 2 convert hot folders above
printpdf Print a PDF file to the SwiftPublish printer (or any Windows printer)

The directories that begin with "convert" and "testlicense" use SwiftConvert instead of SwiftPublish, and will not be discussed here.  For more information see the SwiftConvert Quick-Start Guide

A simple user interface to change these directories or add your own can be accessed from Start...All Programs...SwiftView...DirMon.  It looks like this: 

The following notes are helpful as you create your own monitored directories.

A DirMon monitored directory consists of:
Command Contains the complete command line of the conversion program
Input Folder The full path of the input directory to monitor
Output Folder The full path of the output directory for the converted file
Working Folder The full path of the directory where the file is temporarily stored while being converted
Save Folder The full path of an optional directory, where the input file is left after conversion. If this is not set, the input file is deleted.

Once SwiftPublish is installed, you can copy or move any file to c:\program files\swiftview\importtopcl and collect the converted PCL file in c:\program files\convertout. 

When a file is placed into the importtopcl directory, DirMon waits until the file is fully written, then moves it to the importtopclwork directory and begins to perform the conversion.  During the conversion process, SwiftPublish creates a temporary “tofile” PCL printer and then invokes the input file's associated application.

Once a file is converted, SwiftPublish creates an output file in the convertout directory with the same name as the original input file, but with a .pcl or .tif suffix.  DirMon then deletes the input file. 

The importtotiff directory is the same as importtopcl, except the output file is a TIFF.  Using the importtotiff directory is fully licensed by purchasing SwiftPublish, but requires installing the SwiftConvert software

DirMon can be configured to monitor more directories.  Simply select a directory similar to the one you want to add, modify the settings, and click "Add".

You can drop multiple files into monitored directories, and SwiftPublish will properly queue them.  By default, DirMon runs as many simultaneous conversion processes as the number of processors on your server.  You can change the number of simltaneous processes from the DirMon configuration gui.

Note: when you rename a directory, the original directory is not deleted; you can remove it manually.

In some cases you may need a multi-step process.  This is easily done by setting the output directory of the first monitored directory to be the second monitored directory.  In the example below the original file had lines in an image that were much too light when converted directly to PDF.  The problem was resolved by converting the image to HPGL and then making the lines darker and converting it to PDF.

First process:

      indir=c:\program files\swiftview\importtohpgl
      outdir=c:\program files\swiftview\hpglout
      command="c:\program files\swiftview\sview.exe" -c"set printautorotate disable|ldoc ""%in""|rotate 1|set printres original|draw||save RHPGL_US all ""%outdir\%inbase.hpg"" onefile|set quotechar ^|set onexit ""unlink ^$docname()^""

Second process:

      indir=c:\program files\swiftview\hpglout
      outdir=c:\program files\swiftview\pdfout
      workdir=c:\program files\swiftview\hpgltopdfwork
      command="c:\program files\swiftview\sview.exe" -c"ldoc ""%in""||set allpensblack enable||save PDF all ""%outdir\%inbase.pdf"" onefile|set quotechar ^|set onexit ""unlink ^$docname()^""

Since the output directory in step one and the input directory of step two are the same, the process will look seamless to the end user.  They drop a file into 'importtohpgl' and then pick up the converted PDF from the 'pdfout' directory.

When you install SwiftPublish, you are asked to enter the username and password for an account under which DirMon runs.  This is important to insure that you will see any dialogs that a printing application might display, or to see error messages from DirMon.  Note that the DirMon NT service is titled “SwiftView Tools”.  After installation, you can change the user account under which DirMon and it's applications run from the Control Panel...Administrative Tools...Services menu.

Integration Notes
When integrating DirMon into your process, there are a few details you should keep in mind.

Errors
All errors during directory monitor operation are logged in the Windows Event Viewer.  Open Control Panel...Adminstrative Tools...Event Viewer...Application.  Errors are displayed in console error dialogs in an evaluation install, but this should be disabled for production by unchecking the "Display Errors" option in the DirMon configuration screen. Error display by printing applications depends on DirMon running under the Local System user, see below.

Users and Permissions
DirMon is an NT service named "SwiftView Tools".  It runs under a Log On user account you select at installation, which you can subsequently change from the Control Panel...Adminstrative Tools...Services...SwiftView Tools...right-click...Properties screen.  The Log On user should always be a member of the Adminstrators group.  When initially testing DirMon operation, login as Local System is recommended.  If you find problems accessing resources such as network filesystems, try changing to a real user with network access.

You should check that any conversion application run under SwiftPublish can be started by that user without displaying any dialogs.  Drag a file onto a printer icon to check.

If customizing your own monitored directories you must make sure the SwiftView Tools service user has write access to the monitored directories.  This issue can come up if you are monitoring a directory on a network file server, whether that directory is in a drive location mapped for that user (e.g. "f:\"), or accessed using the full UNC path ("\\hostname\\directory"). 

Input/Output Directories
Each monitored directory set has an input, working, and output directory, but it is possible to share some of these locations among the sets.  In the default configuration, DirMon has separate input and working directories for each type of conversion, however always outputs to the same directory.

You can use the same working and output directory for multiple sets. 

Depending on your setup, you may want to separate some of the directories and share others.  If you were developing an archiving system, for example, this may be useful.  If the users that are creating the initial file have restricted access to directories, it could be necessary to have multiple input directories, each accessible by a user.  Once the files are in the users input directory, the directory monitor could use the same working and output directories since it would have different access restrictions then the user.  The result would be users placing files in individual directories, but all files converted and outputted to the same location.

Technical Details
For more technical details on installing and configuring SwiftPublish, see the SwiftPublish Application Notes.  For more detailed information regarding the Directory Monitor, see the Directory Monitor External Specification



SwiftView®, SwiftConvert, SwiftStamp, SwiftExtract, SwiftReprint, SwiftPublish, and LoanDocs®, are trademarks of eLynx, Ltd.
SwiftView, a division of eLynx, 15605 SW 72nd Ave Portland, OR 97224 USA
800-304-5941 or 971-223-2600
  ©2009 eLynx, Ltd.