Change printer settings based on file name

Image

General

In this article we will explain how you can automatically print files from a hotfolder, but change the printer properties based on a filename.
Let's say that we have these 3 files:

order4546-c.pdf
order54787-m.pdf
invoice-c.pdf

Image

Each filename contains a letter c or m.
Every file ending with c should be printed in color. The files containing m should be printed in monochrome/black&white.

Another common scenario are the number of copies, specified in the filename or the papersize, like: pickinglist-A3-2.pdf where A3 could be the paper size and 2 the number of copies.

For the brevity of this article, we will focus on configuring a single printer property, e.g. color, but configuration for the other printer properties is similar and uses the same methods.

Configuration

  1. Create a new channel
  2. Schedule: Detect files automatically.
  3. Input: set the input type to Local/Network and select the folder to monitor.
  4. Output: set the output type to Print.

Leave the other options and settings default.
We have now have a basic channel that monitors files from a folder and automatically prints them.

Now we will configure the Print-Output:

  1. Enable the checkbox for the Color setting.
  2. Set the default-value to Monochrome.
    A default settings will be used when a recognition does not match.

    Image

  3. Click on the arrows-button to configure the dynamic property.
  4. Select the Enable recognition for: Color checkbox.
  5. Choose property: File name, because the color indication is in our file name.
  6. We will use a regular expression (regex) to filter out the letters c and m from the file name.
    Click Add and select option Regex and click OK.

    Image

  7. For the Regular Expression use this value: (?i).*[-](c|m)[.]pdf and use Group 1 as Result to use.
    This takes the letter c or m that we can use in our lookup.

    Image

  8. Click Add and select option Lookup.
  9. In the Lookup click on Add item. For the first column add c and as result select Color.
  10. Now do the same but for letter m by adding a new entry in the lookup for Monochrome.

    Image

  11. Click OK to close all dialogs.

Testing

Now Start the File Processor, and see how your files are being printed. If you configured correctly, all PDF documents ending with c will be printed in color, the ones ending with m will be printed in monochrome/black&white.