Print Document Using an Empty File Integration (Video - 5:01) Follow


BarTender Content Team


Applies to: BarTender 2016 and later


The purpose of this example is to create an integration that prints a specified BarTender document after detecting an empty trigger file. The techniques involved are also applicable to the later examples.


A parts-manufacturing plant needs to print an item with a serialized number at the end of an assembly line. On this item, there is no other dynamic or changing information, other than the incremented barcode. What generates the trigger file is a “Laser Presence Sensor” toward the end of the assembly line that detects parts and generates an empty text file. The text file drops into a specific directory that the Integration Service is monitoring. When the file is detected, the Integration Service deletes the empty file and prints the specified document.


The following procedures describe how to set up, deploy, and verify the integration for the scenario outlined above.

Set up the empty trigger file

  1. Create the network folder where the empty file will be saved. This is the folder that the Integration Service will monitor. In this example, it will be called \\AssemblyLine\NextPart.
  2. Create, in some other directory, a blank text file called "part.txt".

Create the BarTender document

  1. Open BarTender.
  2. From the File menu, select New to open the New Document Wizard.
  3. Select Blank Template, and then click Finish to close the New Document Wizard. A new document appears in BarTender.
  4. From the File menu, select Print to open the Print dialog.
  5. From the Name dropdown list, select the printer you want to use, and then click Close to close the Print dialog.
  6. From the File menu, select Page Setup to open the Page Setup dialog and configure your page as needed.
  7. When you're finished configuring your page, click OK to close the Page Setup dialog.
  8. From the Create menu, select Barcode.
  9. From the Select Barcode dialog, select a barcode type and click on it. Click the Select button to close the dialog.
  10. Click anywhere on the template to add the barcode object.
  11. Double-click the barcode to open the Barcode Properties dialog.
  12. In the left Navigation Pane, click the barcode's data source.
  13. Click the Transforms tab.
  14. At the right of the Serialization field, click the icon  to open the Serialization dialog.
  15. On the Serialization tab, select Increment.
  16. Click OK to close the Serialization dialog.
  17. Click Close to close the Barcode Properties dialog.
  18. From the File menu, select Save As, and save the BarTender document under the name Serialized.btw.
  19. Close BarTender.

Create and deploy the integration

  1. Open BarTender Integration Builder.
  2. Click Create New Integration to open the New Integration dialog.
  3. Click File and then click OK.
  4. In the File Integration pane, select Integration.
  5. In the Properties pane, enter the Name of your integration as "Each Part".
  6. From the Start Integration dropdown list, select Automatic.
  7. Under User Account, select whether you want to inherit permissions from the service.
  8. Note that by default, actions will inherit the user account specified from the Integration node, so you won’t need to set it again in the Actions node.
  9. In the File Integration pane, select File Detection.
  10. In the Properties pane, under Detection Options, select "Computer/Network" from the Location dropdown list.
  11. For the Folder to Scan option, type the path or browse to the folder that you want the Integration Service to monitor. In this case, specify the \\AssemblyLine\NextPart folder that you created in the Set up the empty trigger file section, above.
  12. In the File Pattern field, type "*.txt". (Do not include the quotation marks.)
  13. Scroll down to the Actions After Detection section. From the Action dropdown list, select Delete File. The file is no longer needed after it has been detected.
  14. In the File Integration pane, click the Print Document action. (This is the default action.)
  15. In the Properties pane under Document, click the Browse button to browse to and select the BarTender document you created earlier, Serialized.btw. Click Open.
  16. Click  in the top left corner of Integration Builder to save the integration file as NewPart.btin.
  17. Click  Deploy Integration to open the New Deployment dialog.
  18. Enter a name and description for the deployment.
  19. Ensure that the Integration File setting lists NewPart.btin. Otherwise, click Browse and browse to and select NewPart.btin.
  20. For Target Servers, add the server(s) you want to deploy the integration file to.
  21. For Schedule, select Immediately.
  22. Specify the desired Error Handling settings.
  23. Click OK to close the dialog and deploy the integration file.
  24. Administration Console will open on the Integrations node, displaying your integration.

Run the scenario and view integration processing

  1. In Administration Console, click the integration name "Each Part" to open a detailed view of the integration.
  2. As you run the example scenario in the next step, you can observe the processing steps of the integration in the Output section of this view.
  3. Using Windows Explorer, copy the blank text file part.txt to the folder \\AssemblyLine\NextPart.
  4. The integration begins almost immediately, deleting the empty text file from the NextPart folder and sending the BarTender document to print. Each time you run the scenario, the barcode on the printed document is incremented by 1.

Do you have feedback or questions on this article? We encourage you to post them on our Community Forums