Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify number of copies #1

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')