I love my Apple II machines, It may not have been the first machine that I got to work / play on, but it shaped the way that I think about computers today. Recently I found myself looking for a use for my Apple II. I have played with the apple II Pi and my SiDrive and a few other pieces of new hardware but even when I had played for awhile I either had to save and just look again later, or dig out a printer (Imagewriter II) and connect the cables and find feed paper, or beat my cut-sheet feeder into submission.
I had read a bit on Facebook and the Apple II newsgroups that some were also interested in this type of printing.
I started looking into what it would take to make a print appear on my wireless attached HP OfficeJet pro 8600 plus. (Could the names get any longer?).
The Raspberry Pi and a serial connection is what you need for IVAN X – Rasapple II – A2Cloud allows you control the Pi from you apple II and do some neet stuff (Tweet, Chat, etc).
This was also the premise of Dave Schmenk’s Apple II pi – Allowing the Apple II to use it’s peripherials (keyboard, mouse / joystick, and even the drives).
So I set off to capture some serial output from the apple II – Appleworks to ImageWriter I could keep this short and then grow the job to see what I could do. Break out the internet and find someone who has captured some serial data with Python.
Capturing raw ImageWriter data out to a file was one thing but then what? Apple to the rescue here. It seems that when Apple made the LaserWriter and all of its PostScript glory, They had a bunch of people that did not want to have to purchase all new programs and the old ones did not have PostScript drivers, so a PostScript ImageWriter was produced. We can use this small program.
So far we have a raw file that we can append the ImageWriter emulator in the front and then send it to a postScript interpreter. Easy enough to test since my MacBook thinks in PostScript. A few bits twiddled and we have output that looks like we would expect. Now we have to make it work on the Pi.
The Rasbian OS has a version of a PostScript Intrepreter called Ghostscript. It also has a print engine that will take a PostScript file or PDF and make it Print on an attached or Network Printer. CUPS, it turns out that Apple Macs also use CUPS as Apple is currently the maintainer of the package.
Install CUPS, install Ghostscript, Capture serial data, prepend a file then crank through the PDF creator in Ghostscript. At this point we have the ability to create and save PDF files out of Apple II ImageWriter output. But why stop there let’s also make the file actually print out one of my printers in the house / lab.
The Python script that I show you here is very simple, Since I’m not a programmer or a real sysAdmin it is a skeleton for others to shape for their environment and then hopefully give back better versions to the community.
I did my testing on a PI3 and all of its quad core goodness, It would be cool to also test and possibly get it to work on a Pi Zero W Since it would be smaller and cost even less.
My setup in the LAB: Apple IIe (unenhanced) but should not matter except for which software you can run. A SuperSerial card set for 9600,n,8.1 ready to print to an actual ImageWriter. A PI 3 with Rasbian, Ghostscript, CUPS, Python. A USB serial dongle, and the appropriate cables to make the connection to the SuperSerial card. After installing CUPS, you need to configure it for your local printer in your environment. Print the test page, it it works then make sure you know the Published NAME of your printer and that part should be ready to go.
Here is the Python and ImageWriter emulator that you will need once you complete the above steps (install CUPS, Ghostscript .. etc).
a2print This is the a2print.zip file.