printer

The printer peripheral allows pages and books to be printed.

getPageSize()Returns the size of the current page.
getPaperLevel()Returns the amount of paper left in the printer.
endPage()Finalizes printing of the current page and outputs it to the tray.
newPage()Starts printing a new page.
getCursorPos()Returns the current position of the cursor on the page.
setPageTitle([title])Sets the title of the current page.
getInkLevel()Returns the amount of ink left in the printer.
write(...)Writes text to the current page.
setCursorPos(x, y)Sets the position of the cursor on the page.
getPageSize()Source

Returns the size of the current page.

Returns

  1. number The width of the page.
  2. number The height of the page.

Throws

  • If a page isn't being printed.

getPaperLevel()Source

Returns the amount of paper left in the printer.

Returns

  1. number The amount of paper available to print with.
endPage()Source

Finalizes printing of the current page and outputs it to the tray.

Returns

  1. boolean Whether the page could be successfully finished.

Throws

  • If a page isn't being printed.

newPage()Source

Starts printing a new page.

Returns

  1. boolean Whether a new page could be started.
getCursorPos()Source

Returns the current position of the cursor on the page.

Returns

  1. number The X position of the cursor.
  2. number The Y position of the cursor.

Throws

  • If a page isn't being printed.

setPageTitle([title])Source

Sets the title of the current page.

Parameters

  1. title? string The title to set for the page.

Throws

  • If a page isn't being printed.

getInkLevel()Source

Returns the amount of ink left in the printer.

Returns

  1. number The amount of ink available to print with.
write(...)Source

Writes text to the current page.

Parameters

  1. ... string | number The values to write to the page.

Throws

  • If any values couldn't be converted to a string, or if no page is started.

setCursorPos(x, y)Source

Sets the position of the cursor on the page.

Parameters

  1. x number The X coordinate to set the cursor at.
  2. y number The Y coordinate to set the cursor at.

Throws

  • If a page isn't being printed.