The RISC OS Printing System (part 9)

Producing exportable files

A month or so ago, I received an email from a reader who asked if it would be possible to produce a printer driver which would output a drawfile. While this is possible, the time required to produce a new class of printer, together with its module etc, meant it couldn't be produced for this month. Then, a few days later, came another enquiry - an HTML printer driver. Well it's a great idea, but there are reasons why this type of output isn't so good as it might sound. One reason is that there is no guarantee the output would be accurate, since different web browsers can produce different outputs from the same file. Even so, it was a tempting thought and, after several days, I realised that both requests can be met, in a limited way, quite easily.

Bitmap output

It is fairly easy to produce a bitmap output using the PDriverDP module with a new dumper module. This new dumper would only be required to build up a bitmap image from the bitmap strips given to it by PDriverDP. Such a dumper exists, produced by David Pilling for use in his SPrinter application. This can be found on the RISC OS 4 website. However, due to the way PDriverDP produces its bitmap, this dumper only produces grey output under RISC OS 3.1. I have therefore produced a dumper which will produce up to 256 colours under RISC OS 3.1 and full colour with RISC OS 3.6 onwards.

Multi-format output

Once the bitmap has been produced, this can be converted to other formats such as GIF, JPEG and HTML. OK, the HTML is a bit of a cheat since it is only a GIF or JPEG file used within an HTML file. It does produce an accurate output on any web browser but, of course, no links can be produced. Sprites can be loaded into Draw, so this will partially satisfy the first request.

Another possibility with this approach is anti-aliasing. Producing a bit image larger than life size then using ChangeFSI to scale it back to the original size anti-aliases the image for enhanced quality (especially font output).

Some problems

Output from PDriverDP is serial and no back-tracking is allowed in the file writing process until the end of the printing. This doesn't seem much of a problem but since the bitmap output from PDriverDP is just the raw sprite output (no header) how can we use ChangeFSI? This is solved by starting off the file with a set of dummy bytes, then calculating the size of the image by adding up the number of bytes of each strip until the end, then writing in the required header info after the printing has been completed.

Another problem is the size of the files produced. This can be many megabytes at greater than 256 colours, so the output in RISC OS 3.6 (and later) is converted to the clear file format which is 75% of the size. This format was used (invented?) by Translator author J Kortink and uses 24 bits (eight for each primary colour) for each pixel. Even with this saving, files can be 50Mb or more when using RISC OS 3.6 onwards, so make sure you have plenty of hard disc space!

Now we come to the use of ChangeFSI. This is probably one of the most used applications on my computer. I know there are other file translation applications but I have 'grown up' with this one and I know everyone should have a copy since it's free with the RISC OS computer. It is especially useful being able to use it from the command line since this method can be used within other applications. There have been quite a few versions of ChangeFSI, and one of the main upgrades occurred when RISC OS 3.6 arrived. This version included a better JPEG compressor, but for anyone who uses earlier versions, I have allowed for them (see end of the article for all the conditions and testing details).

Finally, I have had to allow for the different versions of !Printers. The pdf format changed slightly in version 1.53. The Basic controlling program finds and reads which version of !Printers is installed (no turbo printers) then produces the correct file formats for the pdf and settings files.

More details

As with my colour separation routine, !Printers isn't permanently altered. The background Basic program saves the old setting, alters the setting to include the bitmap dumper, then starts up !Printers. The dumper also sends a message, at the ending of the printing, to the program to pop up the Save as window.

The Save as window has four file format buttons, which are user-selectable, together with other buttons for each file format: for sprite output a menu button which opens the Colours Menu; for JPEG output, a writable icon for the required quality; for GIF output an on/off interlace button and for HTML a choice between using a GIF or JPEG image. A standard file icon and filename writable icon completes this window.

When using the multi-format output, paper sizes aren't relevant since the image size doesn't include any borders, hence no borders are shown in the printing application.

The different resolutions are selected from the printer's output Configuration Window. This only allows the user to change the resolution.

Don't change any of the settings in the printers connection window, since it must send its output to a known position, set up by the Basic program. Clicking on any of the different file formats alters the file icon and filename icon to suitable settings. Note the HTML setting is a directory in which the page and image are produced. To view this page in a web browser, just drag the file page/htm , inside the directory, into your browser. Clicking on the icon to the right of the HTML selector allows the selection of the GIF or JPEG image for the HTML page.

All other formats just produce their files in the required destination. The GIF file is produced using ChangeFSI and Peter Hartley's excellent InterGIF. InterGIF is one of those programs that is used by many people; you can find it at http://utter.chaos.org.uk/~pdh/software/intergif as mentioned in the help file. It will produce animated as well as interlaced GIFs and, from version 6.07, will convert GIFs back to sprites. InterGIF requires about 1.2Mb free memory to work, so those of you with A310s etc, be sure you have that free before printing.

The application has been tested using the following: RISC OS 3.1 and 3.7, using !Printers versions 1.24, 1.53, 1.54 and 1.64 together with ChangeFSI versions 1.12, 1.01 and 0.90. HTML format has been tested on WebsterLT, WebsterXL, Fresco, Bookworm (early Acorn version) and even Microsoft Explorer version 5!

The program MPrtOut is included on this month's disc. Run this to start up !Printers when the multi-format output is required. You can't use this and last month's colour separation program together as each one overrides the other. Make sure your computer has 'seen' ChangeFSI before running MPrtOut.

Well, that wraps it up for this month, but just one more thing to mention: I have updated the Printer Connection checker (Archive 13.9, June 2000) since a reader found that it didn't work if other parallel port driven hardware (e.g. a scanner) was connected via a selector switch. If anyone requires the update just drop me an email.


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