How to print to a text file with Print Distributor
One of the most common subjects we get on our support line is printing to text files using Print Distributor. This article will show you how to setup a virtual printer in Print Distributor which creates a plain text file from your prints. We will also give you some hints for the most common problems.
There are a number of reasons you might want to print to a text file, probably the most common is to export some data from an application which doesn’t have an export facility. Another reason might be to allow a script or program to parse the text file and reformat it before printing.
Setting this is up is quite easy, we will start the wizard in Print Distributor and label our new virtual printer "Text Printer"
Next we will select the Generic Text printer driver. If it doesn’t appear in your list of drivers then use the "Add New" button to install it. Select Generic for the manufacturer and Generic Text for the driver.
Finally we will add a Write File action to store the result out into an archive folder.
Fire up WordPad and type in some text, when you print to the "text printer" a plain text file will be created in the archive folder.
One problem you may encounter is the text not spacing out properly. This is because most Windows application will use proportionally spaced fonts but a plain text file expects each character to have a fixed width. The solution to this is to select a fixed width font in your application, ideally one of the fonts Device Font 10 cpi, 12 cpi or 17 cpi. Using the 17cpi font will allow you to squeeze the most data on the page.
Even at 17 cpi you might find you want to get more data in the width of the page, one option is to select a wider paper format. US Std Fanfold will give you the widest page size. Strangely you need to select portrait mode for the maximum width.
Finally you may find some extra characters in your data, typically a form feed (ASCII 0C) between each page. You can eliminate the form feed character by selecting the paper type "Cont feed no breaks."
If you are printing from a remote host over lpr/lpd then you should use the SimulatePassThrough registry key which will almost certainly give better results than changing the driver settings.