Using Printer Filters

Using Printer Filters

In the designer under page setup, you will see a new option under the template tab for “Printer filter”. You need to create a variable called printer which you can do by simply typing this here:


If the database field contains the actual printer name like below:


Then you can map this variable directly to the database field:


But if the database field contains some value that you want to use to control the destination printer, such as Printer A or Printer B, then you will need to map the variable to a script.

First select the functions tab and enter a script like the one below:

def selectprinter(destination):

 i = destination

  if i == 'A':

    return 'Microsoft XPS Document Writer'

  elif i == 'B':

    return 'Microsoft Print to PDF'


    return 'Default'

You will need to replace the printer names with the real printer names as shown under Windows.

Once done it should look like this:


You will need to create a variable called destination to go along with the one called printer that you created already:


This should be mapped to the database field that contains the value used to calculate the printer name:


And then you need to change the printer variable to point to the script instead of the database field:



Please avoid using the word printer in any other variable names or in the script as it can cause issues.

Now the printer should be selected based on the database field.

Note: When using the Printer filter, if no matching printer is found, the default Windows printer will be used.



Support Team

February 21, 2022

April 26, 2022

Sign In to Post

Welcome back! Login to your account and get access to the CardExchange® Community and start posting today.

Please read our community rules!

Account Registration

Please fill in the fields below and become a member of our CardExchange® Community today!

Please enter the name!
Please provide an username!
Please provide a valid e-mail!
Retype the e-mail!
Please enter a password!
Retype the password!
After you submit your registration you will receive an email with information about your account

ISO/IEC 27001:2013 

United States

201 Sand Creek Rd, Suite L-E
Brentwood, CA 94513

Monday – Friday
9am – 5pm (EST)
+1 (925) 529 4999


Stationsplein 13 A
3818 LE, Amersfoort

Monday – Friday
9am – 5pm (CET)
+31 (0)20 2251 447

© 2022 CardExchange, Inc.