Skip to main content
skill CX Codex

terminal-print — Claude Code skill for terminal printing

terminal-print turns iTerm2 output or a session file into a PDF, then sends it to a network printer. It also provides an AirPrint workaround for blank pages on listed HP LaserJet Pro models.

MIT 131 installs ★ 3 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add terrylica/cc-skills --skill terminal-print -a claude-code
Open on GitHub

What terminal-print does

The skill takes text from the iTerm2 clipboard or a file, removes ANSI escape sequences, and builds a PDF with pandoc and xelatex. It opens a preview before printing. Use --no-preview to skip the preview or --no-print to create a PDF without sending it to a printer.

For HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308, it documents a route around the AirPrint blank-page issue: set up a socket-9100 queue with a Generic PostScript PPD, then print with --bypass-airprint. PDF generation depends on pandoc and xelatex; the skill gives brew install --cask mactex as the installation command.

Choose a printer queue with --printer NAME or the TERMINAL_PRINT_PRINTER environment variable. This workflow targets macOS: it reads the clipboard with pbpaste and submits print jobs through lpr.

What it helps with

  • print copied iTerm2 output
  • make a PDF from a session log
  • prepare terminal logs for paper records
  • work around blank AirPrint output on the listed HP LaserJet Pro models

Example prompts for the agent

  • Print the terminal output I copied from iTerm2.
  • Make a PDF from ~/session.log without sending it to the printer.
  • Set up the AirPrint bypass and print the output with --bypass-airprint.

How to install terminal-print

1Skills CLI (Vercel)

npx skills add terrylica/cc-skills --skill terminal-print -a claude-code

2Manually: put the files in place

~/.claude/skills/terminal-print/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/terminal-print/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about terminal-print

How do I install terminal-print in Claude Code?

Run npx skills add terrylica/cc-skills --skill terminal-print -a claude-code. The skill file is available at ~/.claude/skills/terminal-print/SKILL.md.

What does terminal-print do?

It converts text from the iTerm2 clipboard or a file into a PDF, opens a preview, and submits the document to a network printer. You can also generate the PDF without printing.

How can I fix blank pages on an HP LaserJet Pro?

For the listed models, first run setup-socket-9100-queue.sh to create the alternate queue. Then pass --bypass-airprint to print-terminal.sh.

Source text

SKILL.md · MIT
---
name: terminal-print
description: Print iTerm2 terminal output to network printer. Also documents AirPrint blank-page workaround for HP LaserJet Pro MFP 3101/3108 family. TRIGGERS - print terminal, terminal PDF, print session output, AirPrint blank page, printer prints blank, lpr no output, HP LaserJet driverless blank, IPP-Everywhere blank page.
allowed-tools: Bash, Read
---

# Terminal Print

Print terminal output from iTerm2 to your HP network printer with a single command.

> **Self-Evolving Skill**: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

## When to Use This Skill

Use this skill when:

- Printing terminal output to a network printer
- Creating PDF copies of command-line session output
- Archiving terminal logs in print-friendly format
- Sharing terminal output in meetings or documentation

## Quick Start

1. **Copy** terminal output in iTerm2 (Cmd+C)
2. **Invoke** this skill
3. **Review** PDF preview, press Enter to print

## How It Works

```
Clipboard → Strip ANSI → Markdown code block → pandoc/xelatex → PDF → Preview → Print
```

- **ANSI codes stripped**: Colors and escape sequences removed for clean B&W output
- **Monospace font**: DejaVu Sans Mono for proper character alignment
- **Landscape orientation**: Fits ~120 characters per line
- **US Letter paper**: Auto-detected from printer settings

## Execution

```bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOF
```

## Options

Run with arguments by modifying the execution block:

```bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF
```

| Flag                | Description                                                                                                                |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `--file FILE`       | Read from file instead of clipboard                                                                                        |
| `--no-preview`      | Skip PDF preview, print directly                                                                                           |
| `--no-print`        | Generate PDF only, don't send to printer                                                                                   |
| `--printer NAME`    | Override target printer queue (default: system default)                                                                    |
| `--bypass-airprint` | Use socket-9100 + PostScript queue. Workaround for HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank pages. |
| `-h, --help`        | Show help message                                                                                                          |

## Examples

### Print from clipboard (default)

```bash
# Copy terminal output in iTerm2, then:
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh"
EOF
```

### Print from file

```bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOF
```

### Generate PDF only (no print)

```bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --no-print
EOF
```

## Prerequisites

All dependencies are already available on macOS with MacTeX:

| Tool      | Purpose          | Status            |
| --------- | ---------------- | ----------------- |
| `pandoc`  | Markdown to PDF  | Required          |
| `xelatex` | PDF engine       | Required (MacTeX) |
| `pbpaste` | Clipboard access | Built-in          |
| `lpr`     | CUPS printing    | Built-in          |

## Output

- **PDF location**: `/tmp/terminal-output-YYYYMMDD_HHMMSS.pdf`
- **Markdown source**: `/tmp/terminal-YYYYMMDD_HHMMSS.md`
- **Cleanup**: macOS automatically cleans `/tmp` periodically

## Troubleshooting

### "No text in clipboard"

Copy terminal output first using Cmd+C in iTerm2.

### "Missing pandoc" or "Missing xelatex"

Install MacTeX: `brew install --cask mactex`

### Printer not found

Check printer status: `lpstat -p -d`

The script auto-detects the system default printer. Override with `--printer NAME` or set `TERMINAL_PRINT_PRINTER` in the environment.

### Blank page came out (or `lpr` reported success but nothing printed)

Strong fingerprint of the **HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank-page bug** — the printer's IPP-Everywhere PDF interpreter silently drops jobs while CUPS reports `completed`. Confirmed with this exact symptom on 2026-05-09.

**Quick fix:**

```bash
# 1. One-time setup of bypass queue (socket-9100 + Generic PostScript PPD)
"$(cc-plugin-root doc-tools)/skills/terminal-print/assets/setup-socket-9100-queue.sh"

# 2. Reprint with --bypass-airprint
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --bypass-airprint
```

**Full diagnostic playbook with command sequences and decision tree:** see [airprint-blank-page-troubleshooting.md](references/airprint-blank-page-troubleshooting.md).

Key takeaway: do not trust `lpstat -o` or `job-state=completed` — query the **printer's own job ledger** via `ipptool -tv ipp://<printer>.local.:631/ipp/print` for `job-impressions-completed` and `job-media-sheets-completed`. CUPS lies; the printer (mostly) tells the truth.

## Related Skills

- [pandoc-pdf-generation](../pandoc-pdf-generation/SKILL.md) - General Markdown to PDF conversion
- [asciinema-converter](../../../asciinema-tools/skills/asciinema-converter/SKILL.md) - Convert terminal recordings

## Post-Execution Reflection

After this skill completes, check before closing:

1. **Did the command succeed?** — If not, fix the instruction or error table that caused the failure.
2. **Did parameters or output change?** — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
3. **Was a workaround needed?** — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

© terrylica · MIT · terrylica/cc-skills

Similar skills

All skills for Writing and docs →

From the same set79

The whole set →
notion-sdk notion-sdk — a skill for managing Notion via the official Python SDK. Creates pages and databases, queries information, adds content blocks — all programmatically. CX Codex +1 133installs hooks-development The hooks-development skill guides you through building and debugging Claude Code hooks, with a focus on output visibility. Use it when a hook runs but its message never reaches the agent. CX Codex +1 133installs asciinema-cast-format asciinema-cast-format is a Claude Code skill that helps parse NDJSON headers and terminal events in asciinema v3 .cast recordings. CX Codex +1 132installs python-workspace python-workspace converts MQL5 indicators to Python and exports MetaTrader 5 data headlessly with automated correlation checks. CX Codex +1 131installs doppler-workflows The doppler-workflows skill guides commands that use Doppler secrets for Python package publishing and AWS tasks. It also covers common authentication errors. CX Codex +1 130installs ml-data-pipeline-architecture The ml-data-pipeline-architecture skill covers ML data pipelines built with Polars, Arrow, and ClickHouse. Use it to choose between Polars and Pandas or prepare data for PyTorch. CX Codex +1 130installs clickhouse-pydantic-config clickhouse-pydantic-config turns Pydantic v2 ClickHouse models and environment variables into a DBeaver connection file. Handy when one repo talks to both a local and a cloud database. CX Codex +1 130installs issue-create issue-create turns a rough description into a formatted GitHub issue: detects the type, picks labels that exist in the repo, and warns about duplicates before you post. CX Codex +1 129installs

Project sponsors

Companies that keep this analytics open