Skip to main content

Papyrium

CI License: MIT

Papyrium is a virtual vintage printer. It runs as a headless service, receives the bytes a computer sends to its printer, interprets them as a chosen period printer would, lays the result out on emulated paper, and writes the pages as PNG images and PDF documents, dot for dot.

A condensed ledger report printed by the Epson FX-80 on green-bar listing paper

A letter printed by the Brother M-1109 in near letter quality

The printers are 9-pin dot-matrix printers of the 1980s, the Epson FX-80 and LX-800, the Brother M-1109 and the Star LC-10, speaking Epson's ESC/P, and the IBM Proprinter II, speaking IBM's Proprinter language. The first client is Beebium, the BBC Micro emulator, but Papyrium knows nothing about the computer on the other end: any emulator, or real hardware behind a network adapter, can drive it.

Printers

Each printer model has a demonstration page, printed here by Papyrium itself; papyrium demo MODEL prints one.

The top of the brother-m1109 demonstration page
brother-m1109
The top of the epson-fx80 demonstration page
epson-fx80
The top of the epson-lx800 demonstration page
epson-lx800
The top of the ibm-proprinter-ii demonstration page
ibm-proprinter-ii
The top of the panasonic-kx-p1080 demonstration page
panasonic-kx-p1080
The top of the panasonic-kx-p1080u demonstration page
panasonic-kx-p1080u
The top of the star-lc10 demonstration page
star-lc10
The top of the star-lc10-colour demonstration page
star-lc10-colour

Quick start

With uv, run it straight from PyPI:

uvx papyrium serve

or install the papyrium command for good with uv tool install papyrium (or pipx install papyrium, or pip install papyrium). The one papyrium distribution brings the command and every printer model, font, transport and output.

From a checkout:

git clone https://github.com/rob-smallshire/papyrium.git
cd papyrium
uv sync
uv run papyrium serve

This listens on localhost:9100 (raw TCP, the JetDirect convention) as an Epson FX-80, and writes each job into papyrium-jobs/job-NNNN/:

File Contents
capture.prn Every byte received, exactly as sent
job.json When the job started and ended, why it ended, and the printer setup
page-0001.png, ... Each page, written as the paper is ejected
job.pdf The whole job, written when the job ends

Print something to it:

printf 'HELLO FROM PAPYRIUM\r\n\x0c' | nc localhost 9100

A job ends after five seconds without bytes (--idle-timeout), or when the service stops. A disconnect never ends a job: an emulator may hold one connection open for its whole life.

Printers, paper and fonts

$ papyrium list-models
                                     Models                                     
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                ┃ Description                                            ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ brother-m1109       │ Brother M-1109: an 80-column, 9-pin dot-matrix printer │
│                     │ in its Mode I.                                         │
│ epson-fx80          │ Epson FX-80: an 80-column, 9-pin dot-matrix printer    │
│                     │ speaking ESC/P.                                        │
│ epson-lx800         │ Epson LX-800: an 80-column, 9-pin dot-matrix printer   │
│                     │ speaking ESC/P.                                        │
│ ibm-proprinter-ii   │ IBM Proprinter II: an 80-column, 9-wire dot-matrix     │
│                     │ printer speaking                                       │
│ panasonic-kx-p1080  │ Panasonic KX-P1080: an 80-column, 9-pin dot-matrix     │
│                     │ printer speaking ESC/P.                                │
│ panasonic-kx-p1080u │ Panasonic KX-P1080U: the KX-P1080 for the UK, its      │
│                     │ firmware Papyrium's source.                            │
│ star-lc10           │ Star LC-10: an 80-column, 9-pin dot-matrix printer     │
│                     │ speaking ESC/P or,                                     │
│ star-lc10-colour    │ Star LC-10 Colour: the LC-10 with a four-colour        │
│                     │ ribbon.                                                │
└─────────────────────┴────────────────────────────────────────────────────────┘

$ papyrium list-fonts
                                     Fonts                                      
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                                 ┃ Description                           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ draft-9                              │ An original 9-pin draft font in the   │
│                                      │ style of 1980s dot-matrix printers.   │
│ kx-p1080-draft                       │ The KX-P1080U's draft font, extracted │
│                                      │ from its CPU's internal ROM.          │
│ kx-p1080-draft-italic                │ The KX-P1080U's draft italics,        │
│                                      │ extracted from its CPU's internal     │
│                                      │ ROM.                                  │
│ kx-p1080-nlq                         │ The KX-P1080U's near letter quality   │
│                                      │ font, extracted from its EPROM.       │
│ kx-p1080-nlq-italic                  │ The KX-P1080U's NLQ italics, slanted  │
│                                      │ as the printer slants them.           │
│ lc10-block-graphics                  │ The Star LC-10's IBM block graphics,  │
│                                      │ extracted from its firmware ROM.      │
│ lc10-draft                           │ The Star LC-10's pica draft font,     │
│                                      │ made as the printer makes it.         │
│ lc10-draft-elite                     │ The Star LC-10's elite draft font,    │
│                                      │ extracted from its firmware ROM.      │
│ lc10-nlq-courier                     │ The Star LC-10's NLQ Courier in pica, │
│                                      │ extracted from its firmware ROM.      │
│ lc10-nlq-courier-elite               │ The Star LC-10's NLQ Courier in       │
│                                      │ elite, extracted from its firmware    │
│                                      │ ROM.                                  │
│ lc10-nlq-orator                      │ The Star LC-10's NLQ Orator with      │
│                                      │ lower case in pica, from its firmware │
│                                      │ ROM.                                  │
│ lc10-nlq-orator-elite                │ The Star LC-10's NLQ Orator with      │
│                                      │ lower case in elite, from its         │
│                                      │ firmware ROM.                         │
│ lc10-nlq-orator-small-capitals       │ The Star LC-10's NLQ Orator with      │
│                                      │ small capitals in pica, from its      │
│                                      │ firmware ROM.                         │
│ lc10-nlq-orator-small-capitals-elite │ The Star LC-10's NLQ Orator with      │
│                                      │ small capitals in elite, from its     │
│                                      │ firmware ROM.                         │
│ lc10-nlq-sanserif                    │ The Star LC-10's NLQ Sanserif in      │
│                                      │ pica, extracted from its firmware     │
│                                      │ ROM.                                  │
│ lc10-nlq-sanserif-elite              │ The Star LC-10's NLQ Sanserif in      │
│                                      │ elite, extracted from its firmware    │
│                                      │ ROM.                                  │
│ lx800-draft                          │ The Epson LX-800's draft font,        │
│                                      │ extracted from its firmware ROM.      │
│ lx800-nlq-roman                      │ The Epson LX-800's NLQ Roman font,    │
│                                      │ extracted from its firmware ROM.      │
│ m1109-draft                          │ The Brother M-1109's draft font,      │
│                                      │ reconstructed from printed output.    │
│ m1109-nlq                            │ The Brother M-1109's NLQ font,        │
│                                      │ reconstructed from printed output.    │
└──────────────────────────────────────┴───────────────────────────────────────┘

Choose a printer with --model and set its options with -M KEY=VALUE; papyrium describe-model NAME describes a model and its options, which set its DIP switches and its paper. For example, an M-1109 printing near letter quality from power on, on blue-bar listing paper:

uv run papyrium serve --model brother-m1109 -M near-letter-quality=yes -M stationery=blue-bar

The paper can be a plain sheet, continuous fanfold with its tear-off strips and feed holes, or listing paper: green-bar, blue-bar or music-ruled. A font stands in for each printer's character ROM: draft-9, the FX-80's, is an original design; the M-1109's are reconstructed from its printed output; and the LX-800's and LC-10's are extracted from their firmware, the LC-10 making some of its typefaces from others as the printer does. The Proprinter II borrows the LC-10's until its own are to hand. Any font can be replaced by a dot font file, with -M font=PATH.

Printing from a BBC Micro in Beebium

uv run papyrium serve
/path/to/beebium/build/src/server/beebium-model-b --tcp-printer host=localhost:port=9100

On the BBC:

*FX6,0
*FX5,1
VDU 2
PRINT "HELLO"
VDU 1,12
VDU 3

*FX5,1 selects the parallel printer. The BBC normally suppresses line feeds to the printer and sends CR alone; *FX6,0 lets them through. If you would rather leave the BBC at its defaults, switch on the printer's auto line feed DIP switch instead:

uv run papyrium serve -M auto-line-feed=yes

Escape sequences go to the printer with VDU 1, so VDU 1,27,1,69 turns on emphasized printing (ESC E).

Finding Papyrium on the network

--advertise announces the printer on the local network with multicast DNS, as Bonjour and Avahi announce network printers, so that a sender, such as a bridge from a real computer's printer port, can find it without being given an address:

uv run papyrium serve --model brother-m1109 --advertise --name "Desk M-1109"

It appears as a raw TCP printer, a _pdl-datastream._tcp service. Its TXT record names it a Papyrium printer (note=Papyrium virtual printer, and ty=Brother M-1109 (Papyrium)), so a client can tell it from a real printer, and carries the printer's uuid, which stays the same across restarts and renames. The UUID is kept in printer.json in the output directory; --name defaults to the model's name with "(Papyrium)".

Advertising makes the printer listen on every interface unless a host is given with -T host=. Anyone on the network can then send it jobs, as with any network printer. A printer only this machine can reach is not advertised, and says so. A desktop that adds the printer from its printer dialog must print to it in ESC/P, not PostScript or PCL.

Commands

Command Purpose
papyrium serve Run a printer until interrupted
papyrium render JOB_OR_CAPTURE Print a captured job again, from a job directory or a .prn file
papyrium demo MODEL Print a printer model's demonstration page, showing what it can do
papyrium list-jobs List captured jobs
papyrium list-models, describe-model NAME The printer models installed, and their options
papyrium list-transports, list-languages, list-fonts, list-outputs, list-advertisers The other plug-ins installed

Options are passed as KEY=VALUE: -T for the transport (-T port=9101), -M for the printer model (-M character-set=uk), and -O OUTPUT.KEY=VALUE for an output (-O png.dpi=300). Choose outputs with -o png -o pdf. Reports such as list-jobs print as a table, or as TSV or JSON with --as tsv or --as json.

Replaying a capture with the same printer setup always gives identical pages; render on a job directory uses the setup recorded in its job.json. serve --capture-only captures jobs without printing them, and needs no printer model installed: each job records the model and options asked for, so it can be printed later on a machine that has it.

How it is built

Papyrium is a framework of independent, pluggable axes. Each is an entry-point extension point, so a separately distributed package can add to it, its modules joining the papyrium namespace beside these:

Axis Plug-in Description Module
Transports deliver bytes raw-tcp Raw TCP printing, by default on port 9100 papyrium.transport.raw_tcp
Languages interpret them escp Epson ESC/P, as spoken by 9-pin dot-matrix printers such as the FX-80 papyrium.language.escp
proprinter The IBM Proprinter's language, as the 9-wire Proprinter II speaks it papyrium.language.proprinter
Printer models are what the user chooses brother-m1109 Brother M-1109: an 80-column, 9-pin dot-matrix printer in its Mode I papyrium.model.brother_m1109
epson-fx80 Epson FX-80: an 80-column, 9-pin dot-matrix printer speaking ESC/P papyrium.model.epson_fx80
epson-lx800 Epson LX-800: an 80-column, 9-pin dot-matrix printer speaking ESC/P papyrium.model.epson_lx800
ibm-proprinter-ii IBM Proprinter II: an 80-column, 9-wire dot-matrix printer speaking papyrium.model.ibm_proprinter_ii
panasonic-kx-p1080 Panasonic KX-P1080: an 80-column, 9-pin dot-matrix printer speaking ESC/P papyrium.model.panasonic_kx_p1080
panasonic-kx-p1080u Panasonic KX-P1080U: the KX-P1080 for the UK, its firmware Papyrium's source papyrium.model.panasonic_kx_p1080
star-lc10 Star LC-10: an 80-column, 9-pin dot-matrix printer speaking ESC/P or, papyrium.model.star_lc10
star-lc10-colour Star LC-10 Colour: the LC-10 with a four-colour ribbon papyrium.model.star_lc10
Fonts stand in for character ROMs draft-9 An original 9-pin draft font in the style of 1980s dot-matrix printers papyrium.font.draft_9
kx-p1080-draft The KX-P1080U's draft font, extracted from its CPU's internal ROM papyrium.font.kx_p1080
kx-p1080-draft-italic The KX-P1080U's draft italics, extracted from its CPU's internal ROM papyrium.font.kx_p1080
kx-p1080-nlq The KX-P1080U's near letter quality font, extracted from its EPROM papyrium.font.kx_p1080
kx-p1080-nlq-italic The KX-P1080U's NLQ italics, slanted as the printer slants them papyrium.font.kx_p1080
lc10-block-graphics The Star LC-10's IBM block graphics, extracted from its firmware ROM papyrium.font.lc10
lc10-draft The Star LC-10's pica draft font, made as the printer makes it papyrium.font.lc10
lc10-draft-elite The Star LC-10's elite draft font, extracted from its firmware ROM papyrium.font.lc10
lc10-nlq-courier The Star LC-10's NLQ Courier in pica, extracted from its firmware ROM papyrium.font.lc10
lc10-nlq-courier-elite The Star LC-10's NLQ Courier in elite, extracted from its firmware ROM papyrium.font.lc10
lc10-nlq-orator The Star LC-10's NLQ Orator with lower case in pica, from its firmware ROM papyrium.font.lc10
lc10-nlq-orator-elite The Star LC-10's NLQ Orator with lower case in elite, from its firmware ROM papyrium.font.lc10
lc10-nlq-orator-small-capitals The Star LC-10's NLQ Orator with small capitals in pica, from its firmware ROM papyrium.font.lc10
lc10-nlq-orator-small-capitals-elite The Star LC-10's NLQ Orator with small capitals in elite, from its firmware ROM papyrium.font.lc10
lc10-nlq-sanserif The Star LC-10's NLQ Sanserif in pica, extracted from its firmware ROM papyrium.font.lc10
lc10-nlq-sanserif-elite The Star LC-10's NLQ Sanserif in elite, extracted from its firmware ROM papyrium.font.lc10
lx800-draft The Epson LX-800's draft font, extracted from its firmware ROM papyrium.font.lx800
lx800-nlq-roman The Epson LX-800's NLQ Roman font, extracted from its firmware ROM papyrium.font.lx800
m1109-draft The Brother M-1109's draft font, reconstructed from printed output papyrium.font.m1109
m1109-nlq The Brother M-1109's NLQ font, reconstructed from printed output papyrium.font.m1109
Outputs write pages pdf One PDF per job, one page per printed page, every dot a vector dot papyrium.output.pdf
png PNG images, one per page, with each struck dot drawn as a dot papyrium.output.png
Advertisers announce printers mdns Announces printers with multicast DNS, as Bonjour and Avahi do papyrium.advertiser.mdns

The modules live under src/papyrium/, an implicit namespace package, and their tests under tests/, in the same arrangement:

Module Contents
papyrium.exception Categorised exceptions and CLI error-reporting boundary for Papyrium
papyrium.extension Generic entry-point plug-in machinery shared by every Papyrium extension axis
papyrium.core Papyrium's core: the page model, printer models, jobs, spooling and the plug-in axes
papyrium.transport.raw_tcp Raw TCP transport: the JetDirect-style port 9100 byte stream
papyrium.language.escp The Epson ESC/P printer language for 9-pin dot-matrix printers
papyrium.language.proprinter The IBM Proprinter's printer language, for its 9-wire printers
papyrium.model.brother_m1109 The Brother M-1109 9-pin dot-matrix printer
papyrium.model.epson_fx80 The Epson FX-80 9-pin dot-matrix printer
papyrium.model.epson_lx800 The Epson LX-800 9-pin dot-matrix printer
papyrium.model.ibm_proprinter_ii The IBM Proprinter II 9-wire dot-matrix printer
papyrium.model.panasonic_kx_p1080 The Panasonic KX-P1080 and KX-P1080U 9-pin dot-matrix printers
papyrium.model.star_lc10 The Star LC-10 and LC-10 Colour 9-pin dot-matrix printers
papyrium.font.draft_9 draft-9: a 9-pin dot-matrix font designed for Papyrium
papyrium.font.kx_p1080 The Panasonic KX-P1080U's draft and near letter quality fonts, from its firmware
papyrium.font.lc10 The Star LC-10's draft and near letter quality fonts, from its firmware
papyrium.font.lx800 The Epson LX-800's draft and near letter quality Roman fonts, from its firmware
papyrium.font.m1109 The Brother M-1109's draft and NLQ fonts, reconstructed from its printed output
papyrium.output.pdf PDF output: each job as one document, each dot as a vector dot
papyrium.output.png PNG output: one greyscale raster image per page
papyrium.advertiser.mdns Announcing Papyrium printers on the local network with multicast DNS
papyrium.cli The papyrium command: run a virtual vintage printer and inspect its jobs

docs/specification.md is the design as handed over from Beebium. docs/epson-fx80.md, docs/epson-lx800.md, docs/brother-m1109.md, docs/star-lc-10.md, docs/ibm-proprinter-ii.md and docs/panasonic-kx-p1080.md record the behaviour Papyrium follows, from the manufacturers' manuals and firmware, and CLAUDE.md records the working practices.

Development

uv sync
uv run pytest
uv run pre-commit install

The golden tests replay the captures in each printer model's tests' golden/ directory and compare every page with a pinned image. The end-to-end tests that drive a real Beebium BBC Micro are in integration/beebium/; their module docstring gives the command to run them. oracles/ compares Papyrium with independent interpreters run as separate programs: uv run pytest oracles/escapy.

This README and the printer models' READMEs are generated by scripts/render_readme.py from the templates in scripts/readme-templates/ and beside the modules (src/papyrium/**/README.md.j2), running the examples in scripts/readme-examples/ against Papyrium's own code. The pre-commit hook regenerates them, so edit the templates, not the READMEs.

Licence

Papyrium is released under the MIT licence; see LICENSE.

Epson, Brother and the other printer and computer names in this project are trademarks of their owners, used only to identify the printers that Papyrium emulates. Papyrium is not affiliated with or endorsed by them.

Metadata

Release files for papyrium 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for papyrium 0.3.0
File Size Uploaded Provenance Actions
papyrium-0.3.0.tar.gz 190.8 kB Without provenance Details for papyrium-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for papyrium 0.3.0
File Interpreter ABI Platform Actions
papyrium-0.3.0-py3-none-any.whl Python 3 none any Details for papyrium-0.3.0-py3-none-any.whl

Total release size: 415.9 kB

Release files / papyrium-0.3.0.tar.gz

Download URL papyrium-0.3.0.tar.gz
Size 190.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4a7728ef27267a3383e4bfa041a3de0baebd13aa7203caeced9b99233dfe8d8e
BLAKE2b-256 checksum
How to use checksums
a221214d3d27f9f7969783241c6a7f4eeeef9f7439f9ebadcb0ea558b6d2260a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / papyrium-0.3.0-py3-none-any.whl

Download URL papyrium-0.3.0-py3-none-any.whl
Size 225.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd8d762f0d2f5d76032dff1b25ba4ccb5473302ea547b600d418c56a7177b546
BLAKE2b-256 checksum
How to use checksums
97d78f0b5303c5e924e35ebe9828092c984bf39b73c692a80ee4aa6ecf67d02b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for papyrium 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page