The RISC OS Printing System (part 10)

Running different !Printers

Before I start this month's project, I will answer a question a few readers have asked. Is it possible to have more than one version of !Printers installed on the computer? The answer is ye but with care! I have 1.53, 1.54 (with RISC OS 3.7 in ROM), 1.62 and 1.64. All of these work with their own choices/setups.

Setting up installations

If you are using RISC OS 3.7, !Printers 1.54 settings are held in !Boot....Choices.Printers and they can't be anywhere else.

If you wish to use 1.53 as well, there's no problem as this version is disc-based and it has all its settings within its own application directory.

If you wish to use 1.62, the same applies - its settings are in the choices directory within its own application directory but, after running it, you may find version 1.54 won't work (see fix later).

The trouble starts when you want to use 1.64. It will either change the choices path to, or use the same choices as, 1.54 (I think this depends on your !Boot structure - in my machine it changed the choices path), but the choices can be altered so that it becomes self-contained as per version 1.62.

To do this, open !Printers 1.64 directory and load its !run file into your favourite text editor. Look down the code until you find the line

Set Printers$Dir <obey$dir>

and add the following lines after the above

Set Choices$dir <Boot$Path>Choices
Set Choices$Write <Obey$Dir>.Choices
Set Choices$Path <Choices$Write>

(Some, if not all, of these lines are in the 1.62 !run file but not in 1.64!)

Create a Choices directory within the 1.64 !Printers directory.

Now run !Printers 1.64 and you will find no printers are installed.

Install your printers as required, and Save Choices.

So now you can use version 1.64 as well as any other disc versions, but not 1.54! To recover 1.54, do the following:

You will now find all the versions of !Printers will work.

Now for the down side: since Choice$Path is being changed, any other applications that use this to save their own Choices won't find them! So only save choices in other apps before loading any !Printers.

Now to this month's main topic.

Multi-copy background printing

Even with the great advances in inkjet and laser printers, their main drawback is speed - or the lack of it. This is especially true if the user wishes to produce several copies of a long document. M ageing Canon BJC-610 is not the quickest of printers by today's standards, but I still like its results!

This was brought to my notice when asked to produce 160 programs for a local Son et Lumière. This double-sided A4 document had a full colour picture on one side and text on the other.

I used Ovation Pro on my StrongARM RiscPC, and the time to print one side to file wasn't too long. So I hit on the idea of printing each side to file then constructed a simple program o send the file data directly to the printer. This method speeded up the process but didn't release the computer until all the data had been sent.

Background printing

The next step was to construct a program to send the data from the file to the printer, but in the background. This means the computer can be used at the same time. Computers have a set of buffers (s all reserved areas of memory) which, when written to, will send the data to the required destination. For more details on all the buffers see pages 1-161ff in the PRM. So, if we send data to the prin buffer (buffer number 3), this data will be sent to the printer.

Buffer overflow

A buffer can be likened to a pipe (the length of the pipe being the buffer size), and the data likened to water flowing in the pipe. The flow of data through a buffer is governed by the speed at whic data is taken out - in our case by the printer, but the data can be 'poured into the buffer' at any speed. If the data is poured in at a rate slower than it is taken out, the buffer never fil s - in fact, it will be empty for some of the time - but if the data is poured in quicker than it is taken out, the buffer will fill up and overflow, hence data will be lost.

The operating system sends signals when buffers are full or empty, so the supplier of data knows when to stop sending data and hence prevent overflow, but this still doesn't overcome the problem of h nging up the computer for long periods of time. When the buffer is filled, the data supplier stops sending data, the printer takes some data from the buffer, the supplier then tops up the buffer and o on. This means the computer can only supply data at the same rate as the printer takes out the data, so we're back to square one!

The most efficient way of using this buffer is to fill it, then, while the printer empties it slowly, release the computer back to the user. When the buffer becomes empty, alert the supplier, which t en fills it again, and so on. To the user, the computer is always usable yet the printer continues at its maximum speed. This is what !Printers does, broadly speaking, when printing in the background However, during the printing, the printing application cannot be used. This can be a pain if printing many copies of the same document.

Buffer application

With these ideas in mind, I designed an application which sends a printout file to the printer, in the background, a user-selectable number of times. This means the printing application is relea ed quickly. When run, the application places an icon on the iconbar. Its iconbar menu has the usual Info and Quit options but also a Copies option which opens a writable submenu in which the user can set the number of copies, and a Connection option for the user to select Parallel or Serial, depending on their printer. Once this is set, the user just drags the printout file onto the applicat ons icon and the printing starts. The number of the copy being printed is shown below its icon. Other options on the menu allow the user to Pause, for loading in more paper, or Abort the printin at the end of a copy.

Time saved

Using this application saves time in two ways: the printing application is released quickly since printing is done to file once, and while the copies are being printed, the computer is still usa le.

The application has been tested with RISC OS 3.1 and 3.7. It should work with RISC OS 4 unless they have altered the buffer numbers.

Before I sign off...

The colour separation application (Colsep Archive 13.11 August) has been found not to work with TechWriter so I have re-coded it (thanks to Jim Lesurf for his helpful comments). I have exte ded its spec to include colour separating PostScript files dragged directly onto the Colsep iconbar icon. Drop me an email and I will send you the updated copy.

Well that's it for this month.


Source: Archive Magazine 14.1
Publication: Archive Magazine
Contributor: Brian Pickard