Difference between revisions of "Printer.getPageSize"

From ComputerCraft Wiki
Jump to: navigation, search
(Added Page)
 
m (Expanded)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 
{{Function
 
{{Function
|name=printer.getPageSize
+
|name=''printer''.getPageSize
|returns=Width and Height of the Page in the Printer
+
|returns={{type|number}} width of the page, {{type|number}} height of the page
|api=peripheral
+
|api=printer
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Returns the size of the page.
+
|desc= Returns the size of the paper, works the same way as [[term.getSize]](). 
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc=Prints the size of a page.
 
|desc=Prints the size of a page.
|code=local x, y = printer.getPageSize()<br/>print(x ..", ".. y)
+
|code= local printer = [[peripheral.wrap]]("left")
|output=<width>, <height>
+
 +
[[printer.newPage]]()
 +
 +
local width, height = printer.getPageSize()
 +
 +
print("The size of the page is " .. width .. "x" .. height)
 +
[[printer.write]]("Width: " .. width .. " Height: height")
 +
 +
[[printer.endPage]]()
 +
|output=The size of the page is 25x21
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Latest revision as of 19:04, 9 April 2014


Grid Redstone.png  Function printer.getPageSize
Returns the size of the paper, works the same way as term.getSize().
Syntax printer.getPageSize()
Returns number width of the page, number height of the page
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Prints the size of a page.
Code
local printer = peripheral.wrap("left")

printer.newPage()

local width, height = printer.getPageSize()

print("The size of the page is " .. width .. "x" .. height)
printer.write("Width: " .. width .. " Height: height")

printer.endPage()
Output The size of the page is 25x21