Skip to content

Instantly share code, notes, and snippets.

@dossy
Last active February 4, 2024 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dossy/28d31aa155632a3ffeaaa95adc4ecfe2 to your computer and use it in GitHub Desktop.
Save dossy/28d31aa155632a3ffeaaa95adc4ecfe2 to your computer and use it in GitHub Desktop.
Using GNU enscript and Ghostscript to simulate 132x66 output to PDF

Using GNU enscript to simulate 132x66 output to PDF

Prerequisites

Command

This command will produce an out.pdf file containing two full pages of X characters, with each page fitting 132x66 characters on Legal (8.5"x14") paper in landscape orientation using fixed-width Courier font.

$ enscript -qrl -M Legal -f Courier11.99/7.48 -p - \
    <(yes $(printf "X%.0s" {1..132}) | head -132) \
    | ps2pdf - out.pdf

This might be useful if you have some plain ASCII text that was formatted for printing on an old line printer.

#!/bin/bash
#
# Demo: print-132x66-to-pdf <(yes $(printf "X%.0s" {1..132}) | head -132) > out.pdf
#
enscript -qrl -M Legal -f Courier11.99/7.48 -p - "$@" | ps2pdf - -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment