Skip to content

Commit bb52083

Browse files
committed
Specify number of copies
1 parent a8d4094 commit bb52083

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

brotherprint/brotherprint.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,4 +1065,29 @@ def select_priority_print_option(self, action):
10651065
raise RuntimeError('Invalid action for function select_priority_print_option')
10661066
self.send('^QS'+action)
10671067

1068+
def set_number_of_copies(self, copies):
1069+
'''Set the number of copies. Number must be between 1-999
1070+
1071+
Args:
1072+
Number of copies
1073+
Returns:
1074+
None
1075+
Raises:
1076+
RuntimeError: Invalid number
1077+
'''
1078+
try:
1079+
# get copies option
1080+
copies = int(copies)
1081+
except:
1082+
raise RuntimeError('Invalid number of copies: ' + str(copies))
1083+
1084+
if copies in range(1,999):
1085+
# padded number of copies
1086+
copies_pad = '%03d' % copies
1087+
# send to printer
1088+
self.send('^CN' + copies_pad)
1089+
else:
1090+
raise RuntimeError('Invalid number of copies. Number must be between 1 and 999')
1091+
1092+
10681093

0 commit comments

Comments
 (0)