Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Page

Used to arrange text for the printer.

const page = new Page()
.bold(true)
.text("Hello World!")
.bold(false)
.emptyLine()
.underline(2)
.text("Can you hear me?");

Hierarchy

  • Page

Index

Constructors

Properties

characterSet: CharacterSet = CharacterSets.Brother

The character set to encode characters with. Must match the one set on the printer.

ignoreMissingCharacters: boolean = false

If missing characters should be replaced with a replacement symbol instead of throwing an exception.

width: number = 48

The width to assume for the page in characters.

Methods

  • Sets the text alignment

    Parameters

    • alignment: null | TextAlignment

      The text alignment or null for default

    Returns Page

  • Enables stretching text. Is automatically disabled after a line break.

    Returns Page

  • bold(state: boolean): Page
  • Enables and disables bold text

    Parameters

    • state: boolean

      Should bold text be enabled

    Returns Page

  • characterSize(size: number): Page
  • Sets the character size

    Parameters

    • size: number

      The size of the text. Valid values: 16, 24, 32, 48. Not all values work with all fonts.

    Returns Page

  • characterSpacing(amount: number): Page
  • Sets the space between characters

    Parameters

    • amount: number

      The amount of spacing in dots. Must be between 0 and 127.

    Returns Page

  • doubleStrike(state: boolean): Page
  • Enables and disables striked text

    Parameters

    • state: boolean

      Should striked text be enabled

    Returns Page

  • doubleWidth(state: boolean): Page
  • Enables and disables double width text

    Parameters

    • state: boolean

      Should double width text be enabled

    Returns Page

  • italic(state: boolean): Page
  • Enables and disables italic text

    Parameters

    • state: boolean

      Should italics be enabled

    Returns Page

  • line(characters: string): Page
  • Prints a line of characters

    Parameters

    • characters: string

      A string of one or more characters. Multiple characters are repeated.

    Returns Page

  • lineFeedDots(dots: number): Page
  • Sets the height of a line feed

    Parameters

    • dots: number

      The height of the line feed in dots

    Returns Page

  • text(text: string): Page
  • Prints text

    Parameters

    • text: string

      The text to print

    Returns Page

  • toBuffer(): Buffer
  • underline(amount: number): Page
  • Enables and disables underlined text

    Parameters

    • amount: number

      The distance of the underline. Must be between 0 and 4. 0 disables underline.

    Returns Page

Generated using TypeDoc