<SourceFile> tag content doesn't match the source file name when processing the documents using the Web Capture Station


In Document Definition > Export Settings the <SourceFile> tag is used for export file naming. However, if the image was imported from the Web Capture Station, the name of the exported file does not match with the source one.


The Web Capture Station does not save the source file name in the export file naming <SourceFile> tag.


To use the original filename as a part of the output file name, modify the document definition as described below:

  1. Open the document definition and create a new service field;
  2. Navigate to the field's properties > Data Source tab and select Image Source from the Source drop-down list.

    Note: if necessary, you can hide this field from the document form, so verification operators won't see it, and prevent it from being exported by disabling "Export field value" and "Show on verification" options on the field's properties →  General tab.​

  3.  Create a new text field;​
  4.  Navigate to the field's properties > General tab and set only the Index field option as active.

    Note: you can also turn on the "Show on verification" option just to check whether the source file name will be displayed correctly.

  5.  Go to the Rules tab and create a new script rule:
    • Add both the service field and the text one;
    • Remove the "Read Only" mark from the text field;
    • Enter the following code in the script editor window (it's C# code):
      using System.IO;

      string path = Context.Field("Service Field").Text;
      Context.Field("Name").Text = Path.GetFileName(path);
    • Save changes.
  6. Go to the export settings of the document definition, select required export destination;
  7. Under Template settings click the "Edit..." button and select Advanced view;​
  8. Scroll down tags list, from Index fields select the one that has been created on step 3 (text field with a rule on it);
  9.  Apply new settings, save changes and publish a new version of the document definition.

Have more questions? Submit a request


1 comment

  • Avatar

    Thomas Evans

    I found that when I was returning json, it would return my original file (named testdoc1.pdf) as testdoc1.pdf.json with the above code.  I was able to change the last line to return testdoc1.json:

    using System.IO;
    string path = Context.Field("Service Field").Text;
    Context.Field("Name").Text = Path.GetFileNameWithoutExtension(path);



Please sign in to leave a comment.