Symptoms
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.
Cause
The Web Capture Station does not save the source file name in the export file naming <SourceFile> tag.
Resolution
To use the original filename as a part of the output file name, modify the document definition as described below:
- Open the document definition and create a new service field;
- 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.
- Create a new text field;
- 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.
- 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.
- Go to the export settings of the document definition, select required export destination;
- Under Template settings click the "Edit..." button and select Advanced view;
- Scroll down tags list, from Index fields select the one that has been created on step 3 (text field with a rule on it);
- Apply new settings, save changes and publish a new version of the document definition.
Comments
1 comment
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:
Please sign in to leave a comment.