Serial line printer - first portion of printed document is corrupted

44 Views Asked by At

I am trying to print a document with a serial printer using the command lpr.

The model of printer that I have is Craden DP-9. I am finding the technical manual to be difficult to understand, because it assumes a certain level of familiarity with archaic line printing technology.

Setup

The printer is installed/registered in CUPs as printer1. I can talk to the printer over a USB to serial adapter from my laptop. It reliably exhibits a response to printing jobs, but the documents that come out are always scrambled in various ways.

I am reasonably certain that the printer is in good condition because the self-test document comes out perfectly.

Code

Here is the code that I am attempting to print things with.

#!/bin/bash
# Created on 2023-09-10T17:52:18-04:00
# Author: nate

set -eo pipefail

if [[ -z "$1" || ! -f "$1" ]] ; then
    echo "Please provide an input file."
    exit 0
fi

tempfile="$(mktemp)"
trap "rm -f $tempfile" EXIT

WIDTH="90"
LINES="60"
MARGIN="0"

cat "$1" \
    | unix2dos\
    | tee "$tempfile"\
    | lpr -P printer1 -o raw

cat "$tempfile"

When I run this bash script to print the source code of the script itself:

./print.sh ./print.sh

Here is a scan of the resulting document:

Here is a scan of the resulting document.

A scan of the self-test document, containing debug information:

A scan of the self-test document, containing debug information.

My question

  • Why is the beginning of the document scrambled?
  • For those more familiar with these types of line printers than I am, what are the typical avenues for debugging this type of line printer problem?

Any help is appreciated!

Edit: output of lpoptions

copies=1 device-uri=serial:/dev/ttyUSB0?baud=38400+bits=8+parity=none+flow=soft finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=0 number-up=1 print-color-mode=monochrome printer-commands=AutoConfigure,Clean,PrintSelfTestPage printer-info printer-is-accepting-jobs=true printer-is-shared=true printer-is-temporary=false printer-location printer-make-and-model='IBM ProPrinterII Foomatic/ibmpro (recommended)' printer-state=3 printer-state-change-time=1694275126 printer-state-reasons=none printer-type=8564740 printer-uri-supported=ipp://localhost/printers/printer1
0

There are 0 best solutions below