printer.newPage

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function printer.newPage
Creates a new page to be printed. This function must be called before doing anything with the page.

This function will return false if there is no paper to print on or if there is no ink to print with. It is also possible to print on already printed page allowing to print the first part of the page in one color, another part in another color and so on. After creating a new page the cursor position of new page is reset back to (1, 1).

Note: if there is already created but not printed page running this function will print that page and create a new one, but only if there is any paper and ink in the printer and if there is any space left to print the page.
Syntax printer.newPage()
Returns boolean was the page created successfully?
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Creates a new page, writes "Hello world!" on it and prints it.
Code
local printer = peripheral.wrap("left")

local success = printer.newPage()

if success then
printer.write("Hello world!")
printer.endPage()

print("Page was printed successfully.")
else
error("Page could not be created. Check if there is any paper and ink in the printer.")
end
Output Prints whether or not the page was created and printed.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox