def start_inline(self,stylestack=None):
""" starts an inline entity with an optional style definition """
- print 'start_inline'
self.stack.append('inline')
if self.dirty:
self.escpos._raw(' ')
def start_block(self,stylestack=None):
""" starts a block entity with an optional style definition """
- print 'start_block'
if self.dirty:
- print 'cleanup before block'
self.escpos._raw('\n')
self.dirty = False
self.stack.append('block')
def end_entity(self):
""" ends the entity definition. (but does not cancel the active style!) """
- print 'end_entity'
if self.stack[-1] == 'block' and self.dirty:
- print 'cleanup after block'
self.escpos._raw('\n')
self.dirty = False
if len(self.stack) > 1:
text = text.strip()
text = re.sub('\s+',' ',text)
if text:
- print 'printing text:'+text
self.dirty = True
self.escpos.text(text)
self.left = True
def _txt(self,txt):
- print '_txt: ',txt
if self.left:
if self.clwidth < self.lwidth:
txt = txt[:max(0, self.lwidth - self.clwidth)]
self.crwidth += len(txt)
def start_inline(self,stylestack=None):
- print 'LINE:start_entity'
if (self.left and self.clwidth) or (not self.left and self.crwidth):
self._txt(' ')
text = text.strip()
text = re.sub('\s+',' ',text)
if text:
- print 'LINE:printing text:'+text
self._txt(text)
def linebreak(self):
self.left = False
def get_line(self):
- print 'LBUFFER: '+self.lbuffer
- print self.clwidth
- print 'RBUFFER: '+self.rbuffer
- print self.crwidth
-
return ' ' * self.indent * self.tabwidth + self.lbuffer + ' ' * (self.width - self.clwidth - self.crwidth) + self.rbuffer
formatstr = "{:"+str(width)+"."+str(decimals)+"f}"
- print formatstr
- print value
ret = formatstr.format(value)
- print ret
ret = ret.replace(',','COMMA')
ret = ret.replace('.','DOT')
ret = ret.replace('COMMA',thousands_separator)
ret = ret.replace('DOT',decimals_separator)
- print 'RET '+ret
if symbol:
if position == 'after':
serializer.linebreak()
elif elem.tag == 'img':
- if src in elem.attrib and 'data:' in elem.attrib['src']:
- self.print_base64_image(elem.attrib['src'])
+ pass
+ #if 'src' in elem.attrib and 'data:' in elem.attrib['src']:
+ # self.print_base64_image(elem.attrib['src'])
elif elem.tag == 'barcode' and 'encoding' in elem.attrib:
serializer.start_block(stylestack)