Command Line Conversion with Document Conversion Service


Need: The ability to convert files from a command line interface for use by the Windows Task Scheduler, Powershell, batch files or any application that can call another program.

Document Conversion Service

Solution: A set of command line tools is included with Document Conversion Service.

  • Convert a single file with DCSConvertFile.exe
  • Convert all files in folder, and optionally all subfolders with DCSConvertFolder.exe
    • A search filter, based on file name, can be supplied so that only files that match the filter will be converted.
    • The opposite, an exclude filter, also based on filename, can also be supplied to ignore files that match the exclude filter.
  • Convert a list of files passed via input text file or on the command line with DCSConvertFileList.exe
  • Both DCSConvertFolder.exe and DCSConvertFileList.exe take advantage of the parallel processing available with Document Conversion Service. Multiple documents in the folder or in your list can be converted at the same time.
  • Use DCSCombineFiles.exe to combine a list of files together into a single multipaged TIFF image or PDF file.
    • Files can be listed on the command line or passed via an input text file.
    • The files are appended together in the order in which they are given.
    • Use a serialized output format such as JPEG create a sequential list of files, one for each page.
  • The command line tools all return the following error codes:
    • 0 – success
    • 1 – fail
    • 2 – invalid parameters
  • The results of each command line utility are sent to standard out, while any errors that may have happened are sent to standard error, allowing the use of the DOS pipe (|) and redirect (>, >>) operators.
  • Each of these tools is passed the name of a conversion profile to use to control what type of file is being created. Profiles are lists of settings saved as XML files.  Many sample profiles are included; these can be modified or your own created to meet your exact requirements.
  • The DCSCreateFileList.exe tool can be used to create file lists to pass to DCSConvertFileList.exe and DCSCombineFiles.exe.
    • This tool is optimized for speed and efficiency and will return all files that match the filter provided.
    • Hidden and system files are ignored, and the search pattern filters files based on a regular expression match of the long name of a file.
  • If an error occurs during conversion, a XML file is created on disk that contains complete information about the original conversion request and the results of the conversion. Use the provided DCSExtractResults.exe tool to extract information from this file.
    • You can also choose to always create this file, even when the conversion succeeds.