Printing all open drawings (Python)

Printing all open drawings (Python)
 1# This example creates an IPrintOptions object and intialises
 2# the options. All the open impact.drawings in the application are then
 3# iterated and one copy of each is printed to the specified printer
 4# with a "landscape" orientation.
 5
 6# Create a local variable for the output toolbox
 7ot = impact.gui.output_toolbox
 8
 9# Clear the output toolbox
10ot.clear()
11
12# Create some print options
13options = impact.creator.print_options()
14
15# Define the print options
16options.show_dialog = False
17options.printer_name = "\\SCREAMER\\Canon S820"
18options.number_of_copies = 1
19options.orientation = ipPrintOrientation.poLandscape
20
21# Iterate all the open impact.drawings
22for drawing in impact.drawings:
23
24    # Print the drawing
25    if drawing.print(options):
26        ot.add("Successfully printed '" + drawing.full_name + "' to " + options.printer_name)
27    else:
28        ot.add("Unable to print '" + drawing.full_name + "' to " + options.printer_name)