Sales: 800-304-5941x2
SwiftPublish Application Notes
 

SwiftPublish is a powerful tool for manual or unattended batch conversions of a wide variety of file types such as PDF, HTML, and Microsoft Office documents to PCL or TIFF, on Windows platforms.  Learn about it's general features on the SwiftPublish product page.

Some features of SwiftPublish:

  • Uses the native Windows application (e.g. Word) to render and print.
  • Retains searchable text from the original files when converting to PCL, PDF, or TIFF.
  • Allows easy deployment of networked file conversion services, using the "DirMon" directory monitor.  Note that this utility can also be installed and used separately with SwiftConvert.
  • Runs SwiftConvert on the output PCL file to convert a variety of files to PDF, TIFF, PNG, text, or any other output format supported by SwiftConvert.  No additional licensing is required.

Note that searchable text from the original file is saved as private data in the output file.  This data in PCL files is ignored by printers.  But it can be selected, searched, and copied to the clipboard in SwiftView Viewer (PCL, TIFF) and by Acrobat (PDF).  When converted to TIFF, it allows Windows Search to index the file's text.

SwiftPublish converts PDF files using a built-in print utility.  This is necessary because Acrobat does not perform well as a batch print utility.

SwiftPublish performs all other conversions by printing using the application associated with the file type (suffix).  This provides the most accurate result and allows new file formats and file versions to be supported immediately.

This application note outlines the requirements on printing applications for reliable operation, and options you can configure for dispostion of your converted files.

			Manual Use of SwiftPublish

You can deploy SwiftPublish as a standalone utility on application servers,
file servers, or workstations.  Your users can then convert files by:

 - Printing to the "SwiftPublish" printer
 - Dropping files into a "hot folder", a directory monitored by DirMon

The "DirMon" component of SwiftPublish lets you deploy SwiftPublish or SwiftConvert on a
Windows file server.  Conversion begins automatically within 3 seconds
after a user copies a file to one or more conversion directories.  You can
configure the directories and the disposition of the output files,
e.g. place files in another directory, open them in a program, etc.  
A simple user interface is provided to configure DirMon, and the evaluation
installer includes several sample configurations that run SwiftPublish and SwiftConvert. 
See Using SwiftPublish with the Directory Monitor for details.



			Batch Use of SwiftPublish

SwiftPublish batch operations are controlled through the "SwiftPack
API".  This API is documented in the SwiftPack API specification.  All
modules required to call the API are included in the SwiftPublish
installer.

We strongly recommend that you access this API using the "spbatch.exe"
utility included in the SwiftPublish installation.  It takes care of proper
application syncronization for most applications, which is the most
complex and error-prone part of application integration.  Execute it with
no options in a dos shell to see its command line options (Appendix 1
below).

Appendix 2 below documents the attributes you can supply to spbatch.exe to
configure your SwiftPublish operation.  Note that you can customize your
SwiftPublish installer to preconfigure the defaults for any of
these attributes, or you can set default values in the Windows registry
after SwiftPublish installation, manually, or with a .reg file.  See
the appendix for details.


		      Basic Application Requirements

SwiftPublish performs actual conversions other than from .pdf or .msg by
batch printing using the application associated with the file type
(suffix).  Many Windows applications use file formats that are proprietary
and subject to change with each new release. Use of the original
application (i.e. Word, Excel, Power Point) to convert the document
provides the most reliable and accurate result and also allows new formats
to be supported as soon as the application becomes available.

For reliable batch server operation, your printing application must do the
following:

 - Be registered as the "printto" application for the file type (suffix)
   you wish to convert.
 - Not display dialogs to the user during "printto" batch printing.
 - Run over many print cycles without ongoing leaking or consumption of
   memory.
 - Not abandon temporary files.

Generally, you should discuss your file type, printing application, and
integration method with SwiftView tech support prior to deploying a
SwiftPublish application.  We can recommend application choices and assist
you in qualifying your application to insure reliable operation.  See the
main product page for a current list of
tested and supported file types and applications.

Specific compatability notes:

Microsoft Office applications like Word, Excel, and PowerPoint may crash,
open dialogs when started up for printing, fail to exit, or fail to close
the document file after printing.  Examples:

 - Office 2003-2007 may display a screen of "recovered documents" because
   of using the application interactively on the server, and not exit.
 - Excel 2007 used to print a .xls file written by a previous Excel version
   recalculates formulas and displays a message box to that effect.  
 - Word 2003 on XP may crash when invoked under DirMon running as Local
   System.  SwiftPublish error message: Error adding file , abort
   package and continue; Unable to command application to print via DDE
 - The first time you execute an Office application it may display dialogs
   like installation upgrades, user information etc.  You may have to
   login once as the user under which you are running DirMon and click
   past these dialogs to get the application to work properly under
   DirMon.

Specific Windows platform-related issues:

Windows 2003 Server:

  - The dirmon item is not present in the start menu after installing.

Windows 2000:

  - Running DirMon as Local System, Microsoft Excel 2000 document fails to 
    import to pdf.  An error is generated that printers are Not installed.

Windows 2000 Citrix Server:

  - Running DirMon as Local System, MS Excel 2000 fails.  An error is
    generated that printers are not installed.

  - Running DirMon as a local user (a user that has an account on the
    local system), both MS Word 2000 and MS Excel 2000 silently fail when
    importing files to pcl.  The resultant pcl files generated are 1k
    size. Opening these files displays an error: "The package is empty
    because no documents were added when it was created".

  - Error messages for SwiftPublish may be displayed on the console, not
    in a Terminal Server/Citrix client session.  Insuring that messages
    appear in the client session may require configuring a login action to
    start the "spclientsrv.exe" program.  Contact tech support for details.

Systems that use Firefox Mozilla as a default browser:

  - Importing an html file to pcl (importtopcl) will fail on a system that
    has Mozilla Firefox as the default browser since Firefox does not have
    a "print to" feature.  SwiftPublish will generate an error: "No
    application is registered to print a file with this suffix".

If the document file is not closed, SwiftPublish displays an error (which
can be suppressed with a DirMon Configuration GUI setting).  If the
application fails to exit, SwiftPublish will continue after a configurable
30-second timeout, leaving the input file in the "work" directory.  Other
DirMon operations will continue.


			 Searchable Text Support

Output of searchable text is dependent on the application.  Currently,
most PDF files and almost all portrait-oriented Word, Excel, and
Powerpoint files descramble fully.  Landscape Office files fail to
descrambling 50% of chars with (at least) Office 2003.


	       "Printto" Print Application Registration

Windows Explorer uses a set of Windows registry entries to identify the
application it will invoke for various tasks.  One of these tasks is batch
printing, e.g. when you drag a file and drop it on a Windows Explorer
printer icon.  The "printto" registration enables this task, and is used
by SwiftPublish to perform a batch printing operation to the SwiftPublish
Windows printer created when SwiftPublish is installed.  Here is an
example from the standard SwiftView registration:

      HKEY_CLASSES_ROOT\.pcx: Default value: image/pcx
      HKEY_CLASSES_ROOT\image/pcx\Shell\printto\command: Default value: 
       "c:\program files\swiftview\sview" -v1 -c"set quotechar '|ldoc '%1'|printer number 98 type MS_WIN command ' ' alias '%2,%3,%4'|plot 98 all"

You can manually inspect and configure these registrations via Windows
Explorer...Tools...Folder Options...File Types......
Advanced .  You can also create ".reg" files to add these registrations,
for example:

--------
REGEDIT4

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto]

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto\command]
@="\"C:\\Program Files\\Microsoft Office\\Office12\\WINWORD.EXE\" /n /dde"
"command"=hex(7):76,55,70,41,56,36,21,21,21,21,21,21,21,21,21,4d,4b,4b,53,6b,\
  57,4f,52,44,46,69,6c,65,73,3e,74,57,7b,7e,24,34,51,5d,63,40,35,64,31,60,2c,\
  78,61,54,4f,35,20,2f,6e,20,2f,64,64,65,00,00

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto\ddeexec]
@="[REM _DDE_Minimize][FileOpen(\"%1\")][FilePrintSetup \"%2 on p\",.DoNotSetAsSysDefault=1][FilePrint 0][DocClose 2][FilePrintSetup \"\"]"

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto\ddeexec\Application]
@="WinWord"

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto\ddeexec\ifexec]
@="[FileOpen(\"%1\")][FilePrintSetup \"%2 on p\",.DoNotSetAsSysDefault=1][FilePrint 0][FileExit 2]"

[HKEY_CLASSES_ROOT\Word.Document.8\shell\Printto\ddeexec\Topic]
@="System"

-------

(The blank lines shown are required.)

You can simply double-click on a .reg file in Windows Explorer to update
your registry.

Many programs (e.g. the Word example above) print via DDE as an alternative
to, or instead of, passing the filename and printer name on the command line.
In some cases this will improve print speed, but DDE invocation can cause
problems syncronizing conversions with SwiftPublish.  If you choose to use
DDE, be sure to stress-test operation with SwiftPublish to insure there are
no intermittent problems.  Your application may register for DDE use at
installation time, so if you encounter problems, disable DDE after
installing.  Open Windows Explorer...Tools...Folder Options...File
Types......Advanced...printto...Edit, and uncheck DDE.  You may
need to add double-quotes around the "%1" on the end of to the Application
command line (the document filename substitution), and add the printer
name to the command line; consult your application documentation or command
line usage (invoke app with /h or /?).  Record the DDE settings so you can 
restore DDE operation if you encounter problems.


		 Appendix 1: spbatch command line options

spbatch: SwiftPublish batch job submission utility

Usage: spbatch -f fn -c n -r n -b -d -t n -i n -p -a -q fn -l lic attribute=value ... infile1 infile2 ...
              -f fn  - file containing more filenames to add, one filename per line.
              -c n   - repeat entire run n times, default 1
              -r n   - Add each file n times, default 1
              -b     - do not package all files into one print job;
                       print each file individually to default base printer (override with SwiftPublish=basename).
              -d     - proceed once application exits
                       (proceeds prematurely with some apps that use DDE, so not generally recommended)
              -t n   - timeout and exit(-11) after n seconds waiting for application to exit/AddFile printing or Close to finish.
                       Default -1 = no timeout.
              -i n   - timeout and continue after n seconds waiting for AddFile print job to begin (we must have missed it).
                       Default 30, -1 = no timeout.
              -p     - Don't close print dialogs (disable IE workaround)
              -a     - Abort instead of Close
              -q fn  - Abort if semaphore file fn is removed
              -l lic - Provide a license string
attribute=value pairs define SwiftPack API settings, single-quotes are converted to double-quotes
All attributes are applied to all files (e.g. with the -b option)
Example: spbatch Filename=c:\nt.pcl FilenameEnabled=y "l:\qa\pcl\generala.pcl"



		    Appendix 2: SwiftPublish Configuration

The following attributes may be used in three places:

 - on the spbatch command line (e.g. in a DirMon command line)
 - in the "spprintinst.ini" file used at installation time to configure
   SwiftPublish's default operation
 - in the registry settings created from spprintinst.ini in
   HKEY_LOCAL_MACHINE\SOFTWARE\SwiftView\SwiftPublish\Templates\0000

Other attributes documented in the SwiftPack API are generally for internal
use only, or for features not currently supported in SwiftPublish.

Values are either a simple string or a case-insensitive string
representing a boolean value:

   "y" or "Y" : True
   "n" or "N" : False

      Filename      The name of a file to overwrite with the completed
                    PCL print data.  See the notes below.
      OutputProgram Program+args to run after the output file is written.
                    One %s in the command is replaced with the value of
                    Filename.  Environment variables (e.g. $ProgramFiles
                    on 2K+) may be used (see Filename).  The program is
                    run by CreateProcess() with any DOS box suppressed, as
                    the printing user.  This attribute is ignored if
                    uploading to SwiftSend.  Note that the program assumes
                    responsibility for deleting the output Filename.
      PostProcess   A command line to be executed before running OutputProgram.
		    Typical use is to convert the PCL file with SwiftConvert.
                    Same features as OutputProgram, except that it is not
                    run as the printing user (it is assumed to be a batch
                    utility with no GUI, and is started hidden (SW_HIDE)).
                    Environment variables (e.g. $ProgramFiles on 2K+) may
                    be used (see Filename).  
                    One "%i" is replaced with an input temporary file
                    containing the print data, one "%o" is replaced with
                    the output Filename setting, and one "%l" is replaced
                    with a license string that enables SwiftConvert.  The
                    command is responsible for transferring the data from
                    the "%i" to "%o"; SwiftPublish does not perform it's
                    normal move of the input temporary file to Filename,
                    rather, deletes the input file.
                    Processing continues when the program exits.
                    If Filename or OutputFileOnly is not defined, this
                    parameter is ignored.
      Zip (bool)    zip the file?
      ZipPassword   a zip password, NULL/"" means no encryption.
      ZipPasswordEnabled (bool)
                    if false, ignore Password, no encryption.

   The Filename attribute overrides the default file destination
   established by the SwiftPublish printer.

   Filename can contain environment variables that are replaced from the
   current program environment.  This is the environment of the program
   calling the SwiftPack API (e.g. spbatch) if syncronous disposition is
   selected (spbatch -a), else the spooler environment when asyncronous
   disposition is selected.  An environment variable is "$" followed by a
   string of characters that are not one of "\/. $".

   If syncronous disposition is used (spbatch -s), the following variables
   can be referenced under the Package API or spbatch (v2.7.1+):

   $origdocname - full path of the first filename added to the package
   $origdocdir  - full path to directory containing the first filename added to the package
   $origdocbase - simple name of the first filename added to the package
                  (no directories or .suffix)

   Note that these environment variables can also be referenced in
   SwiftView/Convert ICS commands (as "$envname()"), when run as a
   PostProcess or OutputProgram command.

   Filename can contain the string "XXXXXX"; the "XXXXXX" is replaced with
   a string that makes the filename unique (up to 1000000 existing files).
   If Filename is a simple filename (no '/' or '\' characters), the file
   is placed in the Windows temporary dir, as determined from the
   environment variable $TMP.  Relative paths should not be used; for
   example, the current working directory is not defined with an
   asyncronous SPackClose().

   Otherwise, any missing directories in the path are created as
   needed.  For example either of:

      $TMP\spXXXXXX
      spXXXXXX

   will put the output file in the Windows TMP directory, named
   "sp", without overwriting any similarly-named existing
   files.  Note - $TMP may be undefined, or may be defined differently
   than the setting for the logged-in user when printing to the base
   printer or closing a package asyncronously on NT/win2k, so
   $TMP\xxx files may be placed in "\", usually "c:\", and relative files
   may be placed in a different user's temporary directory, the Windows
   directory, or a user's application data directory.  If you need to
   place the file in a predicatable directory writable by all users, 
   we recommend "$ProgramFiles\SwiftView\temp\spXXXXXX.zhp".

SwiftPublish's evaluation install and configurable download both install a
default printer configuration using the following spprintinst.ini file:
-----
[SwiftView]
Printer Name=SwiftPublish
OutputFileOnly=y
FilenameEnabled=y
ZipPasswordEnabled=y
Zip=y
Descramble=1
----
This configuration causes the user to be prompted for a filename
for the output print file, for easy testing.  You can configure your own
installation as follows:

1. Download the SwiftPublish "customizable installer" from the customer
   download page:

  http://www.swiftview.com/dload/dlmain.htm

It downloads a self-extracting .zip file that contains three files: a
standard "no-printer" installer, spprintinst.exe, and spprintinst.ini,
plus this application note and the directory monitor notes.  

2. Execute the zip file.

3. Edit the spprintinst.ini file as desired.

4. Execute spprintinst.exe, then the "no-printer" installer.  

Once installation is complete, the configuration is saved in this registry
key:

HKEY_LOCAL_MACHINE\SOFTWARE\SwiftView\SwiftPublish\Templates\0000

(Additional "Templates" keys will be present once you have used spbatch, or
if you install another configuration with a different printer name.)

You can change these settings after installing SwiftPublish, using the
regedit program, or with a registry file, for example:

--------
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\SwiftView\SwiftPublish\Templates\0000]
"Zip"="y"
"Filename"="\"C:\\Program Files\\SwiftView\\convertout\\spXXXXXX.zhp\""

-------

(The blank lines shown are required.)

Simply double-click on a .reg file in Windows Explorer to update your
registry.

Copyright (C) 2000-2008 eLynx, Inc.  
Portions of this product Copyright 2007-2008 Glyph & Cog, LLC



SwiftView®, SwiftConvert, SwiftStamp, SwiftExtract, SwiftReprint, SwiftPublish, and LoanDocs®, are trademarks of eLynx
SwiftView, a division of Black Knight Financial Services, 9205 SW Gemini Drive Beaverton, OR 97008 USA
800.720.0196 or +1.971.223.2600
  ©2017 Black Knight Financial Services.