We have started some instructions on how to print the captured PCL data.
This uses the GhostPDL program by https://artifex.com/ - users can download and install the freeware version of this program onto the Raspberry Pi, but unfortunately, we have not been able to get it to print PCL data files downloaded from the internet without GhostPDL reporting an error.
The installation instructions are fairly straightforward (we welcome comments on how to improve this):
Oops - as we are printing out pcl data, we need to use a different program provided as part of the GhostPDL download (now why is that not clear anywhere)..
Ensure cups libraries installed
apt-get install libcups2-dev libcupsimage2-dev
Download GhostPCL:
cd /tmp
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs921/ghostpdl-9.21.tar.gz
tar zxvf ghostpdl-9.21.tar.gz
cd ghostpdl-9.21
./autogen.sh
./configure
make
make install
apt_get install -y inotify-tools
cd /home/pi/
Create a printpcl.sh file:
#! /bin/bash
inotifywait -m -e close_write /home/pi/data/pcl --format "%w%f" --exclude ".*\-output" | \
while read filename; do gpcl6 -sDEVICE=cups -sOutputFile="$filename-output" -dNOPAUSE "$filename"; rm "$filename"; lpr "$filename-output"; rm "$filename-output"; done
Change rc.local to run this script
I am still not quite sure whether this will work (as I cannot actually get CUPS to even print a test page to my printer) however - there has to be a better way!
This uses a two stage approach now - it uses GhostPCL to convert the PCL in /home/pi/data/pcl to a PDF, prints the PDF using LPR command and then deletes the pcl and pdf files from that folder.