PrintTextFile
TextPrinter Sample Application  
[TextPrinter Main Page] [Sample Application] [User Manual] [Javadoc Documentation]
[Installation & Compatibility] [License & Contact Information]

PrintTextFile is a sample Java application showing the use of TextPrinter to print text files.

PrintTextFile has a File menu which allows you to Open any text file and to Print the currently open file.  It also has a Page Setup command which brings up a dialog box that allows you to change all the page formatting parameters supported by TextPrinter.  PrintTextFile also has Font, Style, and Size menus to control the printing font.  A sample file TextPrinterTest.txt is also provided in the same folder and illustrates some of the edge cases supported by TextPrinter.

PrintTextFile is provided as a .jar file containing all the classes it needs to run.  For example, to run PrintTextFile under Windows, launch an MS-DOS window, change the current directory to the folder PrintTextFileTestApplication within the TextPrinter folder, then type

    java -classpath .\PrintTextFile.jar;%classpath% PrintTextFile

A PrintTextFile.bat file is provided to facilitate running PrintTextFile under Windows, just double-click this file.

The source code for PrintTextFile is also provided with this distribution.  It consists of three files: PrintTextFile.java, PageSetupDialog.java, and AboutDialog.java.  You may use, modify, and distribute this code without restriction in developing any application that uses TextPrinter (see License information).  Most of this code was generated by Symantec Visual Cafe, as PrintTextFile was for the most part visually composed.  The resulting source code is fairly verbose but straightforward, and the code relevant to the use of TextPrinter is easy to find.


© Copyright 1998, Wildcrest Associates (http://www.wildcrest.com)