Difference between revisions of "Printer"

From ComputerCraft Wiki
Jump to: navigation, search
(Recipes: Corrected link to Printed Books)
m (Printer API: Recreated table with {{API table}} tag)
Line 49: Line 49:
 
== Printer API ==
 
== Printer API ==
 
The printer API allows programs to interact in various ways with the printer. In order for these functions to become available, you must first wrap the printer as a peripheral using [[peripheral.wrap]]().
 
The printer API allows programs to interact in various ways with the printer. In order for these functions to become available, you must first wrap the printer as a peripheral using [[peripheral.wrap]]().
 +
 +
{{API table|printer|image=Grid disk.png|2=
 +
 +
{{API table/row
 +
|[[printer.getPaperLevel]]()
 +
|{{type|number}} paperAmount
 +
|Returns the amount of paper available in the paper tray.
 +
|odd}}
 +
 +
{{API table/row
 +
|[[printer.newPage]]()
 +
|{{type|boolean}} success
 +
|Starts a new page. Returns true if page got started, false if not.}}
 +
 +
{{API table/row
 +
|[[printer.endPage]]()
 +
|{{type|boolean}} success
 +
|Ends the page and prints the page to the output tray. Returns true if page was ended, false if not.
 +
|odd}}
 +
 +
{{API table/row
 +
|[[printer.write]]({{type|string}} text)
 +
|{{type|nil}}
 +
|Writes text to the paper, works the same way as [[term.write]]().}}
 +
 +
{{API table/row
 +
|[[printer.setPageTitle]]({{type|string}} title)
 +
|{{type|nil}}
 +
|Sets the title of the page.
 +
|odd}}
 +
 +
{{API table/row
 +
|[[printer.getInkLevel]]()
 +
|{{type|number}} inkAmount
 +
|Returns the amount of ink in the ink slot.}}
 +
 +
{{API table/row
 +
|[[printer.getCursorPos]]()
 +
|{{type|number}} x, {{type|number}} y
 +
|Returns the coordinates of the cursor on the paper, works the same way as [[term.getCursorPos]]().
 +
|odd}}
 +
 +
{{API table/row
 +
|[[printer.setCursorPos]]({{type|number}} x, {{type|number}} y)
 +
|{{type|nil}}
 +
|Sets the cursor pos, works the same way as [[term.setCursorPos]]().}}
 +
 +
{{API table/row
 +
|[[printer.getPageSize]]()
 +
|{{type|number}} width, {{type|number}} height
 +
|Returns the size of the paper, works the same way as [[term.getSize]]().
 +
|odd}}
 +
 +
}}
 +
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">
 
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">

Revision as of 22:44, 6 April 2014

Grid workbench.png   Printer
Iso Printer.png
Item ID 4094
Damage Value Un-used.
Peripheral? Yes- Printer (API)

The printer was added in the ComputerCraft 1.42 update. The printer is placed next to a computer, and allows for printing text onto paper with any color of ink.

Recipes

Using the printer will produce Printed Page. These pages can be used in two different shapeless recipes: Printed Pages and Printed Books. Using any of these when on your hotbar will allow you to view their contents (much like with signed books in vanilla).

stone

stone

stone

stone

Redstone

Ink_Sac

stone

stone

stone

printer




String


printed_page

printed_page

printed_page



printed_pages



printed_pages

printed_page


printed_pages

printed_page

String

printed_pages

printed_page


printed_pages



printed_page

String


printed_page

Leather


printed_page


printed_book_



printed_pages

printed_page

String

printed_pages

printed_page

Leather

printed_pages

printed_page


printed_book_



Usage

To use a printer, place it adjacently but not diagonally next to a computer (left, right, top, bottom, front, or back side). Place any color ink in the single left slot, and paper in any of the top slots.

If you are using blocks to pull/insert items from the printer the different slots are available from these sides: Paper tray is accessible from the top, output paper tray is accessible from the front or bottom, and the ink slot is accessible from the back or sides.

Printer API

The printer API allows programs to interact in various ways with the printer. In order for these functions to become available, you must first wrap the printer as a peripheral using peripheral.wrap().

Grid disk.png  printer (API)
Function Return values Description
printer.getPaperLevel() number paperAmount Returns the amount of paper available in the paper tray.
printer.newPage() boolean success Starts a new page. Returns true if page got started, false if not.
printer.endPage() boolean success Ends the page and prints the page to the output tray. Returns true if page was ended, false if not.
printer.write(string text) nil Writes text to the paper, works the same way as term.write().
printer.setPageTitle(string title) nil Sets the title of the page.
printer.getInkLevel() number inkAmount Returns the amount of ink in the ink slot.
printer.getCursorPos() number x, number y Returns the coordinates of the cursor on the paper, works the same way as term.getCursorPos().
printer.setCursorPos(number x, number y) nil Sets the cursor pos, works the same way as term.setCursorPos().
printer.getPageSize() number width, number height Returns the size of the paper, works the same way as term.getSize().

Grid disk.png   Printer API

Method NameDescription
printer.getPaperLevel() Returns the amount of paper available in the paper tray.
printer.newPage() Starts a new page. Returns true if page got started, false if not.
printer.endPage() Ends the page and prints the page to the output tray. Returns true if page was ended, false if not.
printer.write(string text) Writes text to the paper, works the same way as term.write()
printer.setPageTitle(string title) Sets the title of the page.
printer.getInkLevel() Returns the amount of ink in the ink slot.
printer.getCursorPos() Returns the coordinates of the cursor on the paper, works the same way as term.getCursorPos()
printer.setCursorPos(number x, number y) Sets the cursor pos, works the same way as term.setCursorPos()
printer.getPageSize() Returns the size of the paper, works the same way as term.getSize()
GUI of the Printer
Grid Redstone.pngComputerCraft Blocks and Items
Grid paper.png  Blocks
 Iso Computer.png  Computer Iso Advanced Computer.png  Advanced Computer Iso Command Computer.png  Command Computer Iso DiskDrive.png  Disk Drive
 Iso Monitor.png  Monitor Iso Advanced Monitor.png  Advanced Monitor Iso Printer.png  Printer Grid turtle.png  Turtle
 Grid Modem.png  Wireless Modem Grid Ender Modem.png  Ender Modem Grid Wired Modem.png  Wired Modem Grid Networking Cable.png  Networking Cable
Grid paper.png  Items
 Grid Pocket Computer.png  Pocket Computer Grid Advanced Pocket Computer.png  Advanced Pocket Computer Grid disk.png  Floppy Disk Grid printed page.png  Printed Page
 Grid printed pages.png  Printed Pages Grid printed book .png  Printed Book