Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/escpos/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,13 @@ def output(self):
""" Get the data that was sent to this printer """
return b''.join(self._output_list)

def clear(self):
""" Clear the buffer of the printer

This method can be called if you send the contents to a physical printer
and want to use the Dummy printer for new output.
"""
del self._output_list[:]

def close(self):
pass
8 changes: 8 additions & 0 deletions test/test_function_dummy_clear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from nose.tools import assert_raises
from escpos.printer import Dummy

def test_printer_dummy_clear():
printer = Dummy()
printer.text("Hello")
printer.clear()
assert(printer.output == b'')