Skip to content

Commit

Permalink
Merge pull request #1 from dimitrisr/master
Browse files Browse the repository at this point in the history
Specify number of copies
  • Loading branch information
daeta authored Jun 25, 2020
2 parents a8d4094 + 968592a commit 2adf942
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions brotherprint/brotherprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,4 +1065,29 @@ def select_priority_print_option(self, action):
raise RuntimeError('Invalid action for function select_priority_print_option')
self.send('^QS'+action)

def set_number_of_copies(self, copies):
'''Set the number of copies. Number must be between 1-999
Args:
Number of copies
Returns:
None
Raises:
RuntimeError: Invalid number
'''
try:
# get copies option
copies = int(copies)
except:
raise RuntimeError('Invalid number of copies: ' + str(copies))

if copies in range(1,999):
# padded number of copies
copies_pad = '%03d' % copies
# send to printer
self.send('^CN' + copies_pad)
else:
raise RuntimeError('Invalid number of copies. Number must be between 1 and 999')



0 comments on commit 2adf942

Please sign in to comment.