Conditional Printing with layers (Video - 4:14)
Overview
This article will explain how to set a layer to conditionally print.
Conditional printing allows you to set specific conditions under which an object on your document will print. Consider the following example. You run a medical device company who distributes directly as well as through a third party. The labels need to be identical except for which company is distributing the product. By using conditional printing and monitoring the value of a named data source on your template, you can use the same template for both shipping labels. When you print the manufacturer's shipping label, the manufacturer's logo is printed. Likewise, when you print the third party's shipping labels, their respective logo and company name will be printed.
Conditional statements are defined using the When to Print dialog and can be based off of a complex expression or the value of a single data source. All conditional statements in BarTender contain a data source, followed by an operator and an optional value. Complex expressions may also contain one or more conditional joiners.
For more information please review the following resources:
Overview of Conditional Printing (Product documentation)
Overview of layers (Product Documentation)
Introduction to conditional printing
Introduction to layers (Video - 7:09)
How to set a layer to conditionally print
This example uses a sample document to show how to conditionally print layers. The sample document is set up to print different layers depending on whether the manufacturer is distributing the product, or a third party distributor is distributing the product.
DownloadsSample_Conditionally Print Layers.btw
- Open the sample document
- Note that there are two layers in the Layers Toolbox: "Third Party" and "Manufacturer"
- There is a named data source called "Distributor" that will be used to control which layer is printed
- On "Form1", there is a List Box Control linked to the named data source "Distributor" which sets the value at print time.
Tip: Instead of using a List Box Control for conditional printing based on user input at print time, you can link a database field to the named data source "Distributor" for conditional printing based on a database field.
For more information on using a database refer to Getting started with database connections (Video - 5:20)
- Open Layer Properties for the layer "Third Party"
- On the Print Options tab, click the hand icon next to Print When
- Set When to print "Third Party" to "Conditionally, based on data source: Distributor Equals Third Party"
- Click ok to close When to print. Click ok to close the Layer Properties
- Open Layer Properties for Manufacturer, and set When to print "Manufacturer" to "Conditionally, based on data source: Distributor Equals Manufacturer"
- Click ok to close When to print. Click ok to close the Layer Properties
- You are now done setting up conditional printing for each layer
- To test the condition, open Print Preview
- Select "Manufacturer" as the Distributor and click Preview
- Only the Manfufacturer layer shows in the print preview due to the condition
- Close Print Preview, and then start another Print Preview
- Select "Third Party" as the Distributor and click Preview
- Only the Third Party layer shows in the print preview due to the condition