Lino Website

Documentation · Modules

textprinter

lino.textprinter emulates a text-capable printer with basic text formatting (bold, italic, underline, font size,...) and thus brings back a venerable and obsolete layouting model to the GUI world.

In ancient times it was easy to print: you just sent strings to your printer port. People formatted their paper reports using primitive formatting instructions inserted into the strings. These instructions were called «escape sequences» because they usually started with the ESCAPE character (ASCII 27). With these instructions they selected one of the predefined fonts provided by their printer's hardware, they specified the size and appearance (bold, italic, underline),... and were happy with the result.

Nowadays you have a multitude of possibilities if you want to print something, but this old venerable layout model got thrown out together with the bath water.

Lino TextPrinter brings it back.

How prnprint and prn2pdf are used in practice

So you have an old DOS application that can print only to text-capable printers that are connected on LPT1: through LPT3:. How TextPrinter can help you:

First you redirect the printer port to a temporary file. If your application doesn't support redirection, there are tools for this. One I remember was called prn2file.

Now the DOS application thinks that it is printing to a normal text printer, but the printer output is redirected to a file.

Then you run either prnprint.exe if you want to print directly to your Windows-compatble printer, or prn2pdf prn2pdf.exe to create and display a PDF file. (prn2pdf will start your Acrobat Reader to display the output).

Your DOS application must offer a possibility to write your own printer driver, because TextPrinter currently «emulates» only one printer, and furthermore this printer is a fictive one. The Printer Control Commands of this fictive printer are documented in a separate article. It is possible to write emulators for existing printers.

Refering articles:

Copyright 2001-2007 Luc Saffre.
http://lino.saffre-rumma.ee
Generated 2007-06-07 16:23:34