Printing with to specific printer¶
Printing with to specific printer¶
1# This example shows how to print the active drawing
2# It shows how to set the printer to use and display the print dialog
3
4# Create a local variable for the output toolbox
5ot = impact.gui.output_toolbox
6
7# Clear the output toolbox
8ot.clear()
9
10drawing = impact.active_drawing
11
12if not drawing.isNone():
13 options = impact.creator.print_options()
14
15 options.show_dialog = True
16 options.printer_name = "Auto HP LaserJet 6P on SERVER"
17 options.number_of_copies = 1
18
19 if drawing.print(options):
20 ot.add("Successfully printed active drawing to " + str(options.printer_name))
21 else:
22 ot.add("Unable to print to " + str(options.printer_name))
23else:
24 ot.add("No impact.active_drawing")