The thermal printer has a few handy things it can do, most of which are in the A_printertest sketch. These are shown in the image above. In order, starting from the top:

  • Inverted text: this is invoked by calling inverseOn() — you will get text that’s white-on-black instead of black-on-white. inverseOff() turns this off.
  • Double height: this makes text thats extra tall, call doubleHeightOn() — likewise, turn off with doubleHeightOff()
  • Left/Center/Right justified: this aligns text to the left or right edge of the page, or centered. You can set the alignment by calling justify('R') (for right-justified), justify('C') (for centered) or justify('L') (for left-justified). Left-justified is the default state.
  • Bold text: makes it stand out a bit more, enable with boldOn() and turn off with boldOff()
  • Underlined text: makes it stand out a bit more, enable with underlineOn() and turn off with underlineOff()
  • Large/Medium/Small text: by default we use small, medium is twice as tall, large is twice as wide/tall. Set the size with setSize('L')setSize('M') or setSize('S')
  • Line spacing: you can change the space between lines of text by calling setLineHeight() where numpix is the number of pixels. The minimum is 24 (no extra space between lines), the default spacing is 32, and double-spaced text would be 64.

Look through the source of the A_printertest sketch to see these used in context.

This guide was first published on Sep 02, 2012. It was last updated on Mar 01, 2024.

This page (Printing Text) was last updated on Aug 30, 2012.

Text editor powered by tinymce.