Skip to content

printer

Caitlyn edited this page Aug 30, 2026 · 8 revisions

OpenPrinter

The printer requires Ink Cartridges in the left slots and paper in the right slot to print. The top Slot is the input Slot for scanning Pages/Books. The 9 Slots on the bottom are the printer output.

Printed pages are automatically placed into the first Folder in the output slots that has room. Any number of folders may be loaded. If all folders are full, empty ordinary output slots are still used. Books always use an ordinary output slot.

  • 4x Iron Nugget
  • 2x Redstone
  • 2x OpenComputers Microchip Tier1
  • 1x OpenComputers PCB

Methods

op = require("component").openprinter
op.writeln("String",[0xHEXCOLOR],["center"])

Color, and center are optional, format is 0xRRGGBB, using this will add one use of your color ink cartridge, center will attempt to render the string in the center of the page, instead of left justified. you CAN use Minecraft's chat formatting control codes with calls to writeln, Minecraft Color Codes EACH CALL to a COLOR set will add one use of the color ink cartridge, calls to format codes will NOT.

op.setTitle("String")

Sets the "name" of the printed page, this also effects the item display in your inventory, never forget which page is which!

op.getPaperLevel()

Returns the amount of paper in your printer, 0-64 for Normal MC paper, or 0-256 for a paper roll.

op.getColorInkLevel() 
op.getBlackInkLevel()

returns the number of uses left in the ink cartridge 0-4000 (default)

op.clear()

Will clear everything set by previous calls to op.writeln()

op.print():boolean

Queues all previous calls to writeln for printing. The call returns when the job is queued; the printer then takes 0.5 seconds for a one-page print. Each copy is processed separately.

When a writable book is in the paper input slot, the buffered text is appended to that book instead of producing a Printed Page. Book jobs take between 0.5 seconds for one page and 10 seconds for a full 100-page book, ramping up with the number of pages being added. Books only accept plain black text. When the job is complete, the writable book is moved to an ordinary output slot.

op.printAndSign(String:title[, String:author][, Integer:copyCount]):boolean

Queues a writable-book print and seals the completed book as a vanilla Written Book. The author defaults to OpenPrinter.

op.writeln("This is a signed book.")
op.printAndSign("My Book", "Michi")

Empty maps can also be loaded into the paper input slot. Image jobs produce filled vanilla maps in ordinary output slots and take 20 color-ink uses per map. They do not use folders.

op.printMap({
  {0xFF0000, 0x00FF00},
  {0x0000FF, 0xFFFFFF}
}, {title = "Four colors", copies = 2, dither = false})

printMap accepts a sequential table of RGB-number rows, up to 128 by 128 pixels. The image is scaled to the map and can use the title, copies, and dither options.

local file = io.open("picture.png", "rb")
local data = file:read("*a")
file:close()
op.printImage(data, {
  title = "Picture",
  fit = "contain", -- contain, cover, or stretch
  filter = "bicubic", -- nearest, bilinear, or bicubic
  background = 0xFFFFFF,
  dither = true,
  copies = 1
})

printImage accepts PNG, JPEG, GIF, and BMP data. Encoded images are limited to 8 MiB, 4096 by 4096 pixels, and 16 megapixels. The green OpenPrinter Copy Tool includes a printmap program for local files and HTTP(S) URLs.

The queue can be inspected or cancelled without adding controls to the printer GUI:

op.getPrintQueue():table
op.clearPrintQueue():Integer
op.removePrintJob(Integer:index):boolean

getPrintQueue returns jobs with their type, pages, copiesCompleted, copiesRemaining, progress, duration, and status. The first job may be printing, queued, or waiting; waiting jobs also include a blocker message. clearPrintQueue cancels all jobs, including the active one. removePrintJob uses a one-based queue index.

OpenComputers also has an OpenPrinter Queue Tool blue program disk. Its program supports printerQueue to list jobs, printerQueue clear to cancel all jobs, and printerQueue remove <index> to cancel one job. The existing green OpenPrinter Copy Tool remains available for Xerox-style page copying.

op.scan():table

scans a printed page and returns the lines as table

op.scanLine(Integer:lineNumber):String

scans the given line from a printed page

op.scanBook():table

scans a book and returns its as table (vanilla and bibliocraft BigBook are currently supported)

Clone this wiki locally