Overview
This document will outline the process for setting up the Image Plugin created by Field2Base for use with the Data Integration Module (DIM).
The Image Plugin allows a Customer running the DIM to generate Image files (JPG, PNG, etc.) from Camera regions in Sent Forms and store them in a file location of their choosing. There are not a lot of customizable options for this plugin, but the Customer can define the following:
- The Filename of the images outputted based on static text or Form Region data.
- The Folder Location where the images will be saved which can be on the local machine or on a network share.
Installation
Installation involves downloading and copying the Image Plugin and its support libraries to the machine running the DIM service.
Note: Before proceeding, it is assumed that the person doing this setup is familiar with the DIM and already has version 2.2.1 (or newer) installed and running. If that is not the case, please contact your Account Manager about getting the latest version of the DIM.
- On the machine running the DIM, stop the DIM Service by opening up the DIM Admin Utility and stopping the Service or by opening up Windows Services and stopping the Service directly.
- Save the following ZIP file locally on the machine: Download DIM Image Plugin here if you are not using DIM version 7.0. DIM version 7.0 automatically installs the DIM Image Plugin file and you can skip this step.
- Extract and save these files to the DIM Program Files folder. The DIM Program Files folder will be one of the following depending on the machine’s OS:
- 32 Bit: C:\Program Files (x86)\F2B Data Integration Module
- 64 Bit: C:\Program Files\F2B Data Integration Module
Configuration
The configuration involves gathering all of the definitions for using the Image Plugin and then actually creating a project in the DIM Project Manager.
Before starting set-up, define all of the required elements on setting up an Image Plugin DIM Project. The five required Image Plugin Definitions are:
- The name of the eForm that will be generating Images.
- The name(s) of the Image Region(s) in the Form.
- The Filename format of the Image(s) generated.
- The File Type of the Image(s) to be generated (.PNG by default)
- The Folder Location (on the local computer or out on a network share) where the Image(s) will be stored.
Note: If you do not have all of above elements defined, do not proceed any further.
Note: If a DIM Project already exists for this eForm, it is recommended you contact Field2Base Technical Support about the best option to prevent duplications from occurring.
1. Open up the DIM Project Manager Utility.
2. Select the File Menu and click New.
3. Enter your Company ID and Login Credentials.
4. Select Custom Code.
5. For the Class, Click Browse.
6. Select the WriteImagePlugin.dll file.
Note: If you get a "Could not load assembly" error, see the Troubleshooting section below.
7. Enable the Project.
8. Save the Project.
9. Go to the DIM Program Files folder (see #3 in in the Installation section).
10. Open the Jobs folder.
11. Open the .XML file that corresponds to your eForm name using a text editor.
12. Update the <processPlugin> block from “null" />” to “…null”>”.
13. Copy the following lines below that block from the WriteImagePlugin.xml file:
<destinationFolder>c:\test</destinationFolder>
<imageFormat>png</imageFormat>
<saveImageRegion>
<region>Page1@Photo1</region>
<fileName>{internalFormId} Photo1.png</fileName>
</saveImageRegion>
<saveImageRegion>
<region>Page1@Photo2</region>
<fileName>{internalFormId} Photo2.png</fileName>
</saveImageRegion>
</processPlugin>
14. Update the <destinationFolder>, <region>, and <filename> tags with the values for your intended use.
15. If you have more than two Photos that you want captured, then copy additional <saveImageRegion> blocks before the </processPlugin> tag.
16. Save the file.
Additional Configuration Notes
Using Region Names in the Configuration
Regions can be used in the fileName and destinationFolder tags with using this format: {Page1@RegionName}
Modifying the filename Tag
The fileName tag dictates what name the generated file(s) are given per specified Region. For example, if you wanted to specify the fileName would using a Text Region named “PhotoTitle1” that resides on Page 1 of a Form, the resulting configuration for the fileName tag would look like this:
<fileName>{Page1@PhotoTitle1}.png</fileName>
Like in the example block provided earlier, this must be configured per Region. If there are three Regions you would like to have specific names, you must have three <fileName> lines that specify those names. Alternatively, you can set the name of a file to reflect the unique ID associated with the Form using this format: {internalFormId}
Note: Make sure to include the image format as part of the fileName. (PNG, JPG, etc.)
Modifying the destinationFolder Tag
Modifying the <destinationFolder> tag dictates where the images will be placed. This can be a location on a local machine or a network share. The most common way to specify this location is by a static file path, like in the example below.
<destinationFolder>C:\Users\Bob\Desktop\WriteImagePlugin</destinationFolder>
Alternatively, like the filename tag example above, you can set the name to a Region value which would look like this:
<destinationFolder>{Page1@FolderLocation}</destinationFolder>
The imageFormat can be left alone if the PNG file format is acceptable. Otherwise see the notes in the DIM Project (XML) File for other acceptable formats.
Saving the XML Job File
Once you have modified the XML File to your liking, save the file. The DIM project should be ready to be used once the XML Job File has been saved.
Note: If you open a DIM Project in the DIM Project Manager that has edits done directly in the XML with Notepad (or a similar text editor), then please keep in mind that those changes will be lost once you click Save and you will need to re-apply them after you make and save any changes in the Project Manager.
Writing Images to Network Share Locations
The final note to make for the configuration of the DIM Project is that if the image(s) being generated are to be saved on a network share folder location, the DIM Service needs to have the ability to write to that location. If that folder location is not a public folder, then the DIM Service will need to be updated with a User Account (usually a Domain Account) with the privileges to write to that folder. The Service can be updated by doing the following:
- Go to the Windows Services.
- Select the F2B Data Integration Service.
- Stop the Service.
- Right Click and Select Properties.
- Go to the Log On tab.
- Change the “Log on as:” option to This Account.
- Enter the User Account to use.
- Start the Service.
If the Service times out, then the User Account most likely does not have sufficient privileges to access the folder location and another account will need to be used.
Note: Do not proceed with Testing until all changes to the DIM Project have been saved and the file has been closed.
Testing
The testing is a combination of running the new Project with the DIM service and confirming the Project works correctly.
1. Using the same method as the first step in Installation, start the DIM Service.
2. Go to the DIM Admin Utility’s Logs section.
3. Filter the Logs to view today’s date.
4. Confirm the newly created Project loaded correctly. The log will look like:
02/08 11:16:28.56 AM -5 Info : Added job: Test Project
5. Wait a few minutes for the Project to start processing Forms.
6. Confirm the images are being generated correctly. The log will look like:
02/08 11:16:31.70 AM -5 Info : Found 100 RFIs for Test Project
2/08 11:16:54.28 AM -5 Info : Downloading data in Test Project for dispatch 151
Ref#: 12345
Sender: John Doe
Subject: Test Form
Server timestamp: 2/3/2016 12:14:56-05:00
Tablet Serial: F2B-Test-iOS-123
7. Open up a File browsing window and go to the predefined location of the Image(s).
8. Open the images and confirm they are rendered correctly.
Troubleshooting
Could Not Load Assembly - It is possible that you will see the following error when performing step #6 in the Configuration section above.
If this happens it means that the host machine has identified the WriteImagePlugin.zip file that was downloaded as an untrusted source (because it was downloaded from the internet) and it won't allow you to use the WriteImagePlugin.dll file because of this. To fix this issue, follow the instructions below:
- Close the DIM Project Manager.
- Open the location you originally downloaded the WriteImagePlugin.zip file to and locate the zip file.
- Right click on the plugin zip file and navigate to Properties.
- In the bottom right hand corner of the General Tab in the file's Properties Menu, find the check box that says "Un-Block".
- Check the box for Un-Block, click Apply, and then close the properties window.
- Extract the zip file's contents to the DIM Install Folder again. When it asks you to replace the original file, select Replace.
- Now try adding the plugin again and it should work.
Once you've unblocked the original .zip file, the .dll file extracted from it will also be unblocked and allowed to run. Please try step #6 again and continue with the setup process.