File Integration: using an image as trigger and data
Overview
In this example, we will create an integration where we use an image file as a trigger file but also use the same image file inside of the label during print time. So long as the image that you wish to print uses the same name in the trigger file, you can dynamically change the image that you wish to print onto the label during print time.
Sample Files
Implementation
Create a folder called Test in your C:\ drive. We will be using this folder to hold your files as well as be the scan folder for your integration. Place all of your sample files into this Test folder.
Create the BarTender Document
You can use the ImageLabel.btw file up above or simply create a BarTender document with the instructions below:
- Open BarTender Designer
- Create a new BarTender document
- Select the image selector option
up above, and under External Picture File select Specify File Name...
- Navigate to the Test folder, click on the Picture.png file and click Select
- Save your BarTender document and name it ImageLabel.btw
Create the Integration
You can use the ImageFileIntegration.btin file up above or simply create a new integration with the instructions below:
- Open Integration Builder
- Select File from the available integration options
- Under the File Detection options, change the File Pattern to *.png
- In this same window, set the Actions After Detection to None. We'll explain why in a bit.
- Head down to the Print Document action. Under Document, select the ImageLabel.btw as the desired label to print.
- Add an action using the
blue plus button next to the Actions tree. Specifically, we are looking to select the Delete File action:
- Under the File option, navigate and select the Picture.png image as the file to be deleted. This action accomplishes two things:
- It allows the picture to be used for the Print Document action, meaning the label has an image to reference during print time, and
- This ensures that the integration does not go on forever in an infinite loop, which would have happened after setting the Actions After Detection to None.
- Save your integration.
Test the Integration
- Click on the Test Integration option in the Home menu.
- Click on the Start button to the top right hand side of the testing window. Your integration should now start.
- Watch the output messages. Notice how BarTender is able to print the document then delete the image.
- Feel free to test this again by adding another Picture.png of your choosing (remember that you can use whatever image you like so long as the name and extension is is Picture.png when it goes into the trigger Test folder
Deploy the Integration
- From the Integration Builder toolbar, click
Deploy Integration to open the New Deployment dialog.
- In the New Deployment dialog, enter a name and description for your deployment.
- Ensure that the Integration File setting lists IntegrationFile.btin (or whatever name you saved your integration as).
- For Target Servers, add the server(s) you want to deploy the integration file to.
- Specify the desired Error Handling settings.
- Click OK to close the dialog and deploy the integration file.
- Administration Console will open on the Integrations node, displaying your integration.