1

Is it more or less feasible to create PCL files "artisanally", by hand? I have done it for PostScript and found it not particularly difficult, though it takes a lot of time and effort to create even a simple drawing. Now I am faced with an OKI C823 that is connected to an Ubuntu PC, it prints ok but does not understand PostScript - which might explain why it was so inexpensive... (for such a big printer) I did find the below sample in the "PCL XL Feature Reference" but when I fed it to the printer, the text just printed as text instead of drawing the intended line.

eInch Measure
600 600 UnitsPerMeasure
BeginSession // attribute: basic measure for the session is inches
// attribute: 600 units in both X and Y direction
// operator: begin the imaging session
ePortraitOrientation Orientation
eLetterPaper MediaSize
BeginPage // attribute: page orientation is portrait
// attribute: size of media for page is letter
// operator: begin the page description
1200 800 Point
SetCursor // attribute: point a which to set the current cursor
// operator: set the cursor
2400 800 EndPoint
LinePath // attribute: endpoint of a 2 inch line
// operator: add the line to the current path
PaintPath // operator: paint the current path
EndPage // operator: end the page description
EndSession // operator: end the imaging session
Karel Adams
  • 185
  • 2
  • 19
  • NB a converter from PostScript to PCL could be an answer, too. – Karel Adams Jan 19 '20 at 09:46
  • Its my understanding that unlike post script, even though PCL has a human readable "ascii representation" those commands actually need to get converted to opcodes, a binary representation of the pcl, for the printer to understand it, and I don't think there's a linux or open source solution to do that: https://www.tek-tips.com/viewthread.cfm?qid=1673860 – chiliNUT Jan 19 '20 at 10:13
  • 1
    I can confirm that. After I created a x.pcl file with ghostscript, as per the below, I took a look inside: there was a bit of readable text, like @PJL SET RESOLUTION=600; the vast majority of the file is gibberish. – Karel Adams Jan 20 '20 at 07:38

1 Answers1

1

Edit

You can convert ps to pcl with ghostscript

sudo apt-get install ghostscript
gs -o ~/test.pcl -sDEVICE=pxlcolor -f ~/test.ps

or

gs -o ~/test.pcl -sDEVICE=pxlmono -f ~/test.ps

If you need to go backward for some reason--convert pcl to ps--then see the more complicated instructions below


You can convert from pcl6 to ps using GhostPDL from Ghostscript. It's a separate product from Ghostscript, and afaik the only way to install it is to build it from source.

Build It

I'm using ubuntu 18 LTS. some prereqs I needed, your system might already have them

sudo apt-get install autoconf
sudo apt-get install g++
sudo apt-get install make

download the source, untar, and build

wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs950/ghostpdl-9.50.tar.gz
tar xvf ghostpdl-9.50.tar.gz
cd ghostpdl-9.50
sh ./autogen.sh
make

The binaries are in the bin folder

cd ./bin

Sample Usage

I copied a test.ps file from wikipedia that prints "Hello World" in courier.

Convert ps to pcl, convert the pcl back to pdf

./gs -o ~/test.pcl -sDEVICE=pxlcolor -f ~/test.ps
./gpcl6 -o ~/test.pdf -sDEVICE=pdfwrite ~/test.pcl

And everything worked as expected.

chiliNUT
  • 18,989
  • 14
  • 66
  • 106