home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
036
/
fold341.zip
/
FOLD.DOC
< prev
next >
Wrap
Text File
|
1994-08-27
|
44KB
|
1,132 lines
FOLD-and-PRINT
version 3.41
User's Manual
(C) Konrad Budych 1989-94
FOLD-and-PRINT is a utility that allows you to print an ASCII text in
a multi-column format using either single sheets or a fanfold paper on
(probably) any line printer. This saves paper costs and makes it easier to
read texts. It is useful when you want to print long source code listings,
software documentation, or any long and unformatted ASCII texts.
FOLD-and-PRINT always prints in text mode to avoid slow graphics
printing and may use all features that are specific to your printer as the
program is completely configurable. It is possible to print selected pages of
the text: even-, or odd-numbered, starting from, or ending after a given page.
You may prepare easily printouts that you may bind in a binder. All features
are described later in this manual.
I have been using and writing this program for more than 3 years. It
was improved, changed, and rewritten many times. As I find it really useful I
think it may be useful to others too. Just give it a try, play with some
configurations, and very soon you will discover its value.
Real life example: the Canonical List of Blonde Jokes dated 27 Sep
1993 takes 34 pages (17 sheets) if just copied to printer. But it takes only
13 pages (10 sheets saved) if printed in two columns on any ESC/P compatible
printer using 80 lines of 160 characters or 6 pages (14 sheets saved) if
printed in three columns on ESC/P2 printer (Epson LQ-100) using 128 lines of
192 characters. Of course the sheet size is always the same. And magnifying
glass is not necessary to read these printouts.
Laser printer users: sorry. This program cannot be configured to page
oriented printers, you can use it only if your printer is or emulates some
line printer.
WHAT DOES FOLD-and-PRINT EXACTLY DO?
====================================
When you print a text with 'COPY ATEXT.EXT PRN', 'PRINT ATEXT.EXT', or
something similar, you usually get a sheet or two (or hundred) of paper or few
meters (or miles) of fanfold paper that has text printed only near the left
margin, has about 50 to 60 lines on page, and is printed with font which you
can set on the printer's panel.
When you browse through the user's manual of any printer, you should
see, that the printer can print in many modes that are mostly unused by
professional, big applications. These applications usually offer much more
features, but they print mostly in graphic modes, and if you have a slow
printer you sooner or later stop using them for printing ASCII texts (if you
have ever started).
Most dot matrix printers can emulate ESC/P commands. This commands
allow to select different font pitches and line spacings. It is no magic to
print 80 lines of 160 characters on a page. This is still very readable and
there is about 3 times more text on such a page than when you use default 55
lines of 80 characters. Of course if your printer does not support ESC/P
commands you may still use FOLD-and-PRINT. Only you will probably have to
experiment with different features of your printer.
What FOLD-and-PRINT really does is this: it formats a given ASCII
texts into multi-column format, and sends it to the printer, page by page,
preceded and followed by some control codes. The page length, width, margins,
line spacing, etc. are all up to you. Just give FOLD-and-PRINT control codes
to be sent to printer, tell it how many lines fit on a page, how many
characters fit in a line, and that's all! You may make your printouts even in
9 columns from now!
To find more details on how to configure FOLD-and-PRINT see below. If
your printer supports ESC/P (most printers do), you may test using the example
configurations included in the package.
HOW TO INSTALL FOLD-and-PRINT?
==============================
Follow these simple rules when installing FOLD-and-PRINT:
* All *.P files should be in the same directory in which you keep FOLD.EXE.
* It is nice to be able to run FOLD-and-PRINT from any directory and drive.
* Do not install FOLD-and-PRINT if you do not have DOS version 3.0 or newer.
You may just copy FOLD.EXE and *.P files to some directory listed in
your PATH, or create separate directory (like C:\FOLD) and create a BATch file
in one of directories listed in PATH. The batch may look like this:
@c:\fold\fold.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
You may use two ways to set default options: the first is to use FOLD
environmental varaible, the above batch file could look like this then:
@echo off
set fold=-tW -qt -i
c:\fold\fold.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
set fold=
echo on
The variable could be set in your AUTOEXEC.BAT if you want.
The second way is to create FOLD.CFG file. This is an ASCII text file
which contains options that are read prior to command line options. To create
a .CFG file having the same effect as the batch file above, the file should
contain the following lines (not necessarily indented...):
-tW
-qt
-i
If you want you may put all options in a single line. FOLD-and-PRINT first
looks for FOLD.CFG file (in current directory, in FOLD.EXE directory, and in
all directories listed in PATH) and then for FOLD variable. See below for
options description.
After you have learned how to use and configure FOLD-and-PRINT, do not
keep *.DOC files on your hard disk --- the manuals are longer than the program
itself! Just hide the original archive file on some forgotten diskette in
case you ever want to read this text again or your hard disk crashes.
FOLD.EXE and a couple of .P files is enough to use FOLD-and-PRINT.
USING FOLD-and-PRINT
====================
First you will be presented some examples introducing step by step the
major features of FOLD-and-PRINT. The complete syntax and full options
description is presented at the end of this section.
All these examples assume that you have FOLD-and-PRINT configured and
ready to use. If your printer supports ESC/P, FOLD-and-PRINT is ready to use
with default parameters: the condensed Elite font of 80 lines of 160
characters per page is used by default. Use another mode by copying any .P
file to DEFAULT.P or (which is better) using 'p' option, for example:
FOLD -pTINY FOLD.DOC
If your printer does not support ESC/P commands you will have to configure
FOLD-and-PRINT first. See 'COFIGURING FOLD-and-PRINT' section for details.
QUICK START
-----------
To print this file in two columns run:
FOLD -2 FOLD.DOC
You will be prompted for confirmation before the printing starts, and before
each page. Pressing [ESC] always exits to DOS.
If you want to know how many pages of the text will be produced by
FOLD-and-PRINT run:
FOLD FOLD.DOC
FOLD-and-PRINT will analyze the text first, and display how many pages, and
how many 'cuts' (see below) you will get if you use 1, 2, 3, up to 9 columns
of text. Then you will be prompted to press [1], [2], ... [9] to start or
[ESC] to quit. You may always force the analysis of a text using 'a' option:
FOLD -2 -a FOLD.DOC
In this case when prompted you just have to press [ENTER] to use 2 columns.
Of course, thanks to 'a' option, you may use 3 or 8 columns even if you
specified '2' in command line (or configured FOLD-and-PRINT always to use 2
columns by default).
If you want to print the text using different font pitch and/or size,
use 'p' option followed by a .P filename. For example:
FOLD -2 -pTINY FOLD.DOC
You may create a couple of .P files with a couple of print formats you like
most and use them quickly with .P options. Use your printer capabilities fully
when creating these files!
WHEN COLUMN IS TOO NARROW
-------------------------
When column is too narrow a 'cut' occurs. Normally the text which
would not fit in a column will be printed in the same column in the next line.
The number of cuts in texts can be determined in text analysis.
When the text is cut, a word may be broken in any place. When many
words in text are broken, the text becomes illegible. To prevent this, you
may use 'tw' option. This makes FOLD-and-PRINT not break words in the middle,
but move an entire word to the next line in the same column. For example:
FOLD -4 FOLD.DOC
would produce a very hard to read printout, but
FOLD -4 -tw FOLD.DOC
would produce a not so hard to read printout. Sometimes when a word is longer
than the width of a column it is not possible to leave it intact. In such
cases FOLD-and-PRINT will behave as if the 'tw' option was off.
You may not want to print the line endings that do not fit in a
column. They may contain less important information (like comments in
assembly language source code :). You may cut them to give a printout a nicer
look. To truncate lines that do not fit in a column use 'tt' option, for
example, compare the analysis results of:
FOLD -tt FOLD.DOC
and
FOLD FOLD.DOC
especially in 4 or more column modes.
When the text being printed contain TAB characters you may try to
change TAB width to make the text narrower. To do this, use 'g' parameter
as in example:
FOLD -g3 -t FOLD.DOC
This will cause FOLD-and-PRINT to expand TAB characters to every 3rd position
(1, 4, 7, and so on) and not to every 8th as it is done by default.
To restore the original mode of breaking lines, use 'tb' option. It
may be useful when you SET 'tt' or 'tw' in FOLD variable and want to override
this setting.
The 'tB' and 'tW' options act almost the same way as 'tb' and 'tw'.
The difference appears if a line to be cut contains no letters nor digits only
graphics or punctuation: if 'tB' or 'tW' is used the part to be moved to the
next line is ignored and is not printed.
WHEN A RIBBON IS WEAK
---------------------
If you print a lot of texts, sooner or later a ribbon in your printer
will become weak and printouts gray instead of black. You may of course
replace the ribbon, but if it is weak and you very much want to print
something in black FOLD-and-PRINT can help. Use 'b2' option to print each line
not once but twice, or 'b3' to print each line 3 times, and so on. For
example:
FOLD -2 -b3 FOLD.DOC
will print FOLD.DOC in two columns each line three times.
WHEN A TEXT IS LONG
-------------------
When a text you print is very long and you print it on a fanfold paper
or you have a sheet feeder, you may do not want to sit and look the at printer
working, and pressing [ENTER] from time to time to confirm printing of
succeeding pages. Or you may want to print first the left pages and then the
right pages on the same sheets to make a book-like printout. FOLD-and-PRINT
can help in each situation:
FOLD -n -2 FOLD.DOC
This will print FOLD.DOC in two columns but you will be able to leave the
printer unattended as no user action will be necessary. You only have to
confirm the start of printing.
If you want to print only even- or odd-numbered pages of a text use
'oe' and 'oo' options:
FOLD -oo -n FOLD.DOC
FOLD -oe -n FOLD.DOC
These two commands will cause printing the one half of FOLD.DOC first and then
the other half next. Both halves will be printed in no-wait mode described
above.
If you are going to print first one half of a text (odd pages) and
then the second half (even pages), you may use 'ox' option:
FOLD -ox -n FOLD.DOC
This command does exactly the same what the previous two. You will hear a
beep and be prompted to press a key after all odd pages have been printed.
The 'oa' option selects default mode.
To print only specified range of pages you may use 'f', 'l', and 's'
options. Here are some examples:
FOLD -f3 FOLD.DOC
This will print FOLD.DOC starting with page 3.
FOLD -f3 -l4 FOLD.DOC
This will print FOLD.DOC starting with page 3 and ending after page 4.
FOLD -s4 FOLD.DOC
This will print 4th page of FOLD.DOC. Please note that '-s4' is a shortcut
for '-f4 -l4 -oa' and that 'oe', 'oo' and 'ox' options can be combined with
'f' and 'l'.
When the text is really very long, and you keep it in separate files,
which you print in turn, you may change the way FOLD-and-PRINT assigns page
numbers. Normally the first page has number 1 (no matter you print it or not)
and so on. This can be changed with 'r' option:
FOLD -r67 FOLD.DOC
This will print FOLD.DOC, but the first page will have number 68 and so on.
So when you print a second part of a big text, know that first part had (for
example) 43 pages, you add 'r43' in the next FOLD-and-PRINT run.
It is possible to use 'r' with negative values:
FOLD -r-3 -s4 FOLD.DOC
This will print 4th page of FOLD.DOC with number 1.
WHEN YOU HAVE A BINDER
----------------------
If you like to keep all sheets of your printout tightly bound
together, you may tell FOLD-and-PRINT to leave margins which will allow
binding sheets:
FOLD -2 -mb FOLD.DOC
This will print FOLD.DOC in two columns. Right pages (odd-numbered) will have
a left margin and left pages (even-numbered) will have a right margin so the
printout will be excellent to be put in a binder.
Please note that all columns are more narrow if use use this option.
This may increase the number of cuts in a text.
The width of the binder margin can be set up in the printer definition
file (see below) and changed from command line with 'M' option. For example:
FOLD -2 -mb -M20 FOLD.DOC
The 'ml' and 'mr' options can be used to print a text with margin
always on the left ('ml') or the right ('mr') side. This may be useful in
some situations.
HEADERS AND FOOTERS
-------------------
At the top of every page FOLD-and-PRINT usually prints a header. At
the bottom of every page FOLD-and-PRINT usually prints a footer. What they
contain is determined by the contents of the printer configuration file being
used (see below) and a title which is defined for a single session.
The contents of headers and footers are defined separately for odd and
even pages in the printer configuration file. The special symbol pairs
consisting of a percent sign (%) and a character can be used if you want page
numbers, date, time, file name appear in the headers and footers. See
'COFIGURING FOLD-and-PRINT' section for a full list of these symbols. A
special symbol pair is %T or %= defines 'user's title'. It defaults to file
name but if you use 'qt' or 'qa' options you will be able to enter your own
text, for example, a document's title.
Suppose you want to print a text with some special headers or footers.
You don't need to change the printer configuration files, you may use 'qh' or
'qa' options. It causes FOLD-and-PRINT to ask you for a text of the header
and the footer before it prints anything, if 'qa' is used you will be asked
also for a title. The 'q-' can be used to disable asking for anything.
Suppose you want to print a bare text, without any header nor footers.
You may use 'da' or 'dA' option. FOLD-and-PRINT will not print any header or
footer on any page it this mode. If 'dA' is used, the input text will be
printed in the regained space thus the printout will be shorter. To disable
printing headers and footers only on the first page use 'df' option. The 'd-'
switches to default mode.
COMPLETE SYNTAX AND OPTIONS DESCRIPTION
----------------------------------------
You may run 'FOLD -?' to see the help screen.
The full syntax is as follows:
FOLD [options] filename [options]
Options may be preceded by either '-' or '/'. Options must be
separated: something like '/i/da' or '/ida' is legal but treated as '/i', you
should use '/i /da'.
Single letter options (like 'i', 'n') are turned on when they are
followed by a '+' or nothing (eg. '-i+ -n') and turned off when followed by a
'-' (eg. '-i-'). Please note the they are no longer switches: '-n' always
turns no-pause mode on and *does not* toggle this mode as it was in versions
2.91 to 3.1.
The groups of two-letter options (like 'oo', 'oe', 'ox', 'oa') can be
considered as multi-position switches: only one option of the group is active
at the moment.
The options with parameters require that there is no space between the
option letter and a parameter; for example '-f 120' is invalid, but '-f120' is
okay. If such an option is used twice or more the last occurence is valid,
all earlier are ignored. The numbers (nnn) must never be zero. Page numbers
are from 1 to 9999.
The content of environmental variable FOLD is always scanned before
any command line arguments, so you may turn on some options using this
variable.
Filename is any legal DOS filename with optional drive and path.
Wildcards ('*' and '?') are not allowed and only one file name can be given.
Error occurs otherwise.
Single '-' or '/' in command line disables option scanning. This
feature may be used to print a file with the name beginning with '-'. For
example:
FOLD -ox -tW - -A-FILE.TXT
Here is the full list of options that are available in FOLD-and-PRINT
version 3.41:
Page layout:
-1, -2,... -9: specify number of columns
if none of these is used, user is asked to select her/his
choice after a text analysis
-a: force text analysis (-a- to disable)
-tb: break long lines (default)
-tB: same, ignore ends without alphanumeric chars
-tw: break long lines using word wrap
-tW: same, ignore ends without alphanumeric chars
-tt: truncate long lines
Headers and footers
-qh: ask for headers and footers to be used in this session
-qt: ask for user defined title used in header/footer
-qa: ask for headers, footers, and title (also -q)
-q-: don't ask, use defaults from .P file (default)
-da: disable all headers and footers (also -d)
-dA: like -da, but text is printed in regained space
-df: disable headers and footers on the 1st page
-d-: don't omit headers and footers (default)
Margins:
-m-: no margins (default)
-ml: left margins
-mr: right margins
-mb: margins for binder: left on odd, right on even pages
-M<nnn>: set margin width (default in .P file)
Page selection and numbering:
-f<nnn>: first page to print (default: 1)
-l<nnn>: last page to print (default: 9999)
-s<nnn>: print only <nnn>'th page
-r<nnn>: add <nnn> to page numbers (default: 0)
-oo: only odd pages
-oe: only even pages
-ox: two passes: first odd, then even pages
-oa: all pages (default)
Miscellaneous:
-n: don't wait for confirmation before each page (-n- to disable)
-b<nnn>: print each line <nnn> times (default: 1)
-i: print blank-space message on the last page (-i- to disable)
-ci: ignore (send to output) non-printable characters
-cr: remove non-printable characters
-cs: substitute non-printable characters with '@'
-ca: abort if non-printable characters found (default)
-g<nnn>: set tab width (default: 8)
-z<file>: send output to a <file>, default is PRN
-p<file>: use given printer definition <file>, default is DEFAULT.P
-P<path>: specify path for printer definition files
-?: display help screen
And here is the detailed description of all options (options in parens are
shortcuts):
-1, -2, -3,... -9
These options can be used to specify the desired number of columns
which FOLD-and-PRINT should use when printing text. If none of them is
specified, FOLD-and-PRINT will analyze the text first and then prompt user to
specify the number of columns. However if 'a' option is on, FOLD-and-PRINT
will always analyze the text.
If any two of these options are given the last is valid. Everything
after the digit is ignored.
-a
This option forces the text analysis. FOLD-and-PRINT reads the text
first and displays how many pages, and how many cuts you will get if you use
1, 2, 3, up to 9 columns of text. Then you will be prompted to press [1],
[2], ... [9] to start or [ESC] to quit.
The analysis is very fast: on 386 40 MHz it was around 1500 lines of
the text per second.
Please note, that you will always be prompted to press a key, even if
you turn on 'n' option.
-tt
This option will tell FOLD-and-PRINT to truncate lines that don't fit
in a column. The text that is truncated will not be printed anywhere on the
page. Normally too long lines are printed in 2 or more lines in a column.
-tw
This option will tell FOLD-and-PRINT to use word wrap when breaking
too long lines that do not fit in a column. The part of line that is moved to
the next line is always left justified.
A word is a sequence of letters and/or digits. If a word is longer
than the column width it is truncated.
-tb
This option will tell FOLD-and-PRINT to break too long lines. This is
on by default setting. There's always one-space gap between adjacent
columns.
-tW, -tB
Same as 'tw' and 'tb' but if the part of the line to be moved to the
next line does not contain letters and digits, it is ignored and not printed.
-qh
This option causes FOLD-and-PRINT ask user for a header and a footer
to be used in printing a file. User may use special characters described
below.
If headers and footers are not printed (see 'da' below) this
option is ignored.
-qt
This option causes FOLD-and-PRINT ask user for a title to be used in
printing a file. A title is inserted in a header/footer in the place of %T or
%=. The default title is a file name.
If headers and footers are not printed (see 'da' below) this
option is ignored.
-qa (-q)
This has the effect of both 'qh' and 'qt'.
-q-
This disables asking for a header, a footer, and a title. The default
contents from a .P file are used.
-da (-d)
This option tells FOLD-and-PRINT not to print any headers or footers.
It works even if 'qh', 'qt', or 'qa' was used.
-dA
This option works almost as 'da', but in the empty space at the top
and the bottom of the page, the text from the input file is printed. This
results in shorter printout, but which may be less readable on the fanfold
paper.
-df
This option tells FOLD-and-PRINT not to print any headers or footers
on the first page (page number one to be precise: see 'r'). It works even if
'qh', 'qt', or 'qa' was used.
-d-
This can be used to revoke 'da' or 'df'. All headers and footers are
printed. This is the default setting.
-ml, -mr
This options activate using left ('ml') or right ('mr') margins. The
width of the margin (in characters) is taken from a printer definition file
and can be overridden with 'M' option.
-mb
This option tells FOLD-and-PRINT to make margins which will make easy
to put a printout into a binder: left margins on the odd pages and right
margins on the even pages. The width of the margin (in characters) is taken
from a printer definition file and can be overridden with 'M' option.
-m-
This disables using margins. This is the default setting.
-Mnnn
This options can be used to redefine the margin width to nnn
characters.
-fnnn
All pages before the nnn'th page will not be printed. The first
printed page will be nnn'th or the one after nnn'th if 'oe' and 'oo' options
does not allow printing of the nnn'th page.
-lnnn
All pages after the nnn'th page will not be printed. The last printed
page will be nnn'th or the one before nnn'th if 'oe' and 'oo' options does not
allow printing of the nnn'th page.
-snnn
Only the nnn'th page will be printed. The '-snnn' is a shortcut for
'-fnnn -lnnn -oa'. You can print only one page using this option, specifying
'-s10 -s11' will result in printing of the 11th page.
-rnnn
To all page numbers printed in headers/footers nnn will be added. For
example, if you use 'r10', the page number 1 will have number 11, 2 - 12, and
so on. It is possible to use negative values also. This is useful when you
print a document contained in many files.
While this option is active (nnn is not 0) FOLD-and-PRINT will display
the real page number is square brackets.
-oe
FOLD-and-PRINT will print only even-numbered pages of the specified
range. To be precise: it will not print odd-numbered pages.
-oo
FOLD-and-PRINT will print only odd-numbered pages of the specified
range. To be precise: it will not print even-numbered pages.
-ox
This option causes FOLD-and-PRINT to print odd-numbered pages first,
and even-numbered pages next. It is a shortcut for two FOLD-and-PRINT
invokations: one with 'oo' and one with 'oe'.
-oa
FOLD-and-PRINT will print all pages from the range specified by the
'f' and 'l' options. This is the default setting.
-n
Normally FOLD-and-PRINT before it starts printing a page it stops,
allowing you to change the sheet of paper, and displays a question like this:
Page 4: reading.... print (Y/n/a)?
You may press [Y] (or [ENTER]) to print this page, [N] not to print, or [A] to
print this and all following pages without the prompts. [ESC] aborts the
program. If 'n' option is used FOLD-and-PRINT does not ask these questions
and prints the page immediately after it has been read in and prepared for
printing.
-bnnn
FOLD-and-PRINT will boldface a printout: each line of text will be
printed nnn times without a linefeed. A 'b1' resumes printing a line once.
-i
This makes FOLD-and-PRINT print on the last page, which is usually not
filled up, the text defined in the printer definition file in the middle of the
blank space. The default text is this:
[ This space has been intentionally left blank ]
The text is not printed if there is less than 10 empty lines left on the last
page.
-ci
This makes FOLD-and-PRINT ignore (treat as all other characters)
control characters which may be printer control codes and can mess up a
printout.
-cr
This makes FOLD-and-PRINT remove (not to send to a printer) control
characters which may be printer control codes and can mess up a printout.
-cs
This makes FOLD-and-PRINT substitute control characters with '@'
character and print them as normal characters.
-ca
This makes FOLD-and-PRINT abort when control characters occur. This
is the default setting.
-gnnn
nnn is a number from 2 to 32. This sets TAB width to nnn, ie. TABs
are expanded to every nnn'th column. Default is 8.
-zfilespec
When this parameter is given in command line FOLD-and-PRINT will not
send the text being printed to a printer (ie. file PRN) but to the file
specified after 'z'. filespec is any valid file name. If the specified file
exist it will be overwritten without a warning. You have just been warned.
-pfilespec
Normally FOLD-and-PRINT uses printer control codes, page layout, and
other configurable information from the printer definition file DEFAULT.P. If
you want to use another printer definition file use 'p' option followed by
file specification. The default extension which you can omit is '.P'. The
file is first searched for in the current directory, then in directory
specified by '-P' option, then in the directory in which FOLD.EXE resides, and
then in all directories listed in your PATH.
-Ppath
This option specifies additional path where FOLD-and-PRINT looks
for printer definition files. This path is searched *after* the current
directory but *before* FOLD.EXE home directory and PATH directories.
-?
Use this to display the help screen. FOLD-and-PRINT will not do
anything else if this option is given. The help screen is not displayed if
you run FOLD-and-PRINT without any parameters as it was in versions 2.91 thru
3.1.
HINTS
-----
Here are some hints which you may find helpful in using
FOLD-and-PRINT. Please also have a look at hints after the 'Configuring...'
section.
* FOLD-and-PRINT can print in one column too. If you want to print a
text in one column with the designed-by-you headers and footers, and have all
features of FOLD-and-PRINT, just tell FOLD-and-PRINT to use 1 column. For
example:
FOLD -1 SOMETEXT.ASC
* The text analysis is very helpful; you may want to use 'a' option in
the FOLD variable. Before you print anything you may look at what number of
columns will be the best for a text --- minimum cuts and pages.
* If in the analysis you see that the last page is filled in less than
10 percent you may want to remove some blank lines from the text to make it
fit on fewer pages. Especially if the text contains groups of more than one
empty line.
* All trailing spaces are removed from the input text to avoid
breaking blank lines.
* If you use 'qa', 'qt', 'qh', use 'ox' instead of 'oe' and 'oo' to
avoid re-typing the texts of a header, a footer, and/or a title.
* If you want to print a text in any number of columns you want,
reformat the text so that each paragraph is a long line (but no longer than
255 characters) and use 'tw' or 'tW' options: FOLD-and-PRINT will reformat the
text for you!
CONFIGURING FOLD-and-PRINT
==========================
FOLD-and-PRINT uses printer definition files to make the full use of
specific capabilities of your printer. The printer definition file is an
ASCII file that contains all data needed by FOLD-and-PRINT to print a text in
the specific mode.
A single printer definition file contains information about page size
and layout (length of the page in lines, width of the line in characters, the
number of lines at the top and bottom of the page used for margins, the
position within these margins of a header and a footer, and in the end a text
of the header and the footer) and information needed to correctly print in
this mode (printer control codes used to initialize and terminate printing
mode and codes to be printed before and after each page).
SAMPLE PRINTER DEFINITION FILE
------------------------------
The structure of a printer definition file is very simple and very
rigorous. It will be described in detail with the use of an example. Here it
is one of the example printer definition files (the left margin of two tabs
and line numbers are NOT included in the real file (DEFAULT.P) and are only
used to explain the contents of the file in this documentation and for further
explanation). The comments (texts after a ';') are truncated and shortened
--- you may want to print the original DEFAULT.P file as it is fully commented
and may be used as a reference. Only numbered lines are important. Here it
is:
;
; The next two lines *must not* be changed.
;
1 FOLD-and-PRINT printer definition file
2 REV 3 BEGIN
;
; The next three lines are for your information only.
; They are displayed on screen while FOLD-and-PRINT is w...
; They contain: the file creator/modifier, printer and f...
;
3 Konrad Budych
4 any ESC/P compatible printer
5 condensed Elite pitch
;
; The next line contains page layout parameters:
; * 2 numbers: page length (in chars) and height (in l...
; * 2 numbers: size of top and bottom margins (in line...
; * 2 numbers: position of header and footer inside to...
; * 2 numbers: position of line of '-'s inside top and...
; * 1 number: default margin size in chars, can be ch...
;
6 85 160 2 3 1 3 2 -1 10
;
; Now headers text with special symbols (described in FO...
; The first line contains a header for odd, the second f...
;
7 %X ver. %V on %C, %P%J%U
8 %U%J%X ver. %V on %C, %P
;
; The footers text (first for odd, then even pages).
;
9 %J- %N -%J
10 %J- %N -%J
;
; The printer initialization codes (\xx is hex code).
;
11 \1B@\0F\1B8\1BM\1B0\1BR\00\1Bt\01\1B6
;
; The printer de-initialization codes.
;
12 \1B@\07
;
; The page initialization codes.
;
13
;
; The page de-initialization codes.
;
14 \0C
;
; The next line is printed in the middle of the blank s...
; if -i option is used and there is at least 10 empty l...
;
15 [ This space has been intentionally left blank ]
;
; The next line *must not* be changed.
;
16 END
;
; The rest of this file is ignored.
;
The 1st, 2nd, and 16th lines are necessary for FOLD-and-PRINT and
always have the same contents. Everything after 16th line is ignored.
Lines 3 thru 5 contain the text describing the file creator (line 3),
your printer (line 4) and the print mode which is used (line 5). They are
only displayed on the screen and have no meaning to 'the real work'.
The 6th line contains 9 numbers and they are respectively:
* the length of the page in lines (85 in the example)
* the width of the line in characters (160 in the example)
* the number of empty lines at the top of page used as margin (2)
* the number of empty lines at the bottom of page used as margin (3)
* the position of the line with header within the top margin (1)
* the position of the line with footer within the bottom margin (3)
* the position of the line of hyphens within the top margin (2)
* the position of the line of hyphens within the bottom margin (-1, disabled)
* the default width of a margin (10 characters)
If the 'position' numbers are out of range defined by 3rd and 4th
number, the header/footer and/or hyphens will not be printed.
The 7th and 8th lines contain the headers text and the 9th and 10th
the footer. First line of both pairs contains a text for odd pages, the
second, for even ones. This can be any text of your choice and you may use
some special symbols there (they all begin with a '%'):
%U user's title (file name or a text entered by user)
%F name of printed file
%N current page number
%J space filler (see below)
%C today's date
%P current time (it will be different on different pages)
%D file creation/last modification date
%T file creation/last modification time
%S file size in bytes
%Z file size in kilobytes (rounded)
%X text saying: 'Printed using FOLD-and-PRINT'
%V FOLD-and-PRINT version number
%% a '%' sign
The date and time formats are those used by DOS. Please also note,
that the case of letters used in the symbols is important: '%u' is not the
same as '%U'.
Space fillers allow to use left- or right-justified headers and
footers as well as centered ones. Each space filler (%J) is replaced with a
string of spaces, all fillers in one header/footer are replaced by the same
number of spaces. The total number of spaces in all fillers plus length of a
text is equal to line length. Some examples should clear it:
%JPage %N.%J
Text will be centered (the same number of spaces from each side).
File %F%JPage %N
Texts will be in both corners (a lot of spaces between).
%JTOP SECRET%JTOP SECRET%J
The first text will be in 1/3rd and the second in 2/3rd of line length.
Note that the same symbols can be used when FOLD-and-PRINT asks you
for a header and a footer when 'qh' or 'qa' option is used. User's title
defaults to the file name unless 'qt' or 'qa' is used.
Lines 11 thru 14 contain printer control codes which are used:
* to initialize the printer and turn on the desired print mode (line 11)
* to return the printer to default mode after printing is complete (line 12)
* to initialize printing of each page (line 13)
* to end printing of each page (line 14)
Non-visible control codes or non-ASCII characters can be entered as
hexadecimal codes in the format '\nn' (without quotes) where nn are exactly
two hex digits (0..9, A..F). For example \1B is ESC (ASCII 27) character.
In the example shown above we initialize the printer with ESC @
(standard initialize for ESC/P printers) \0F (= SI condensed printing) ESC 8
(ignore out of paper --- allows printing more on the page) ESC M (Elite pitch)
ESC R 0 ESC t 1 ESC 6 (use IBM character set I, allow printing upper codes,
and use US characters --- this is not important, but allows printing texts
with characters > 128). We de-initialize printer with ESC @ BELL (some
printers rings when they receive bell character and this let you know that
printing is finished... if you have very quiet printer). After each page we
send FF (form feed) to spit out the page.
Line 15 contains a text printed in the middle of the last page if a
'i' option is used.
HOW DOES FOLD-and-PRINT USE THE PRINTER DEFINITION FILE?
--------------------------------------------------------
Here is the detailed algorithm of what use FOLD-and-PRINT makes of
each item in the printer definition file:
First two lines and the 16th line are ignored, but necessary; lines 3
thru 5 are displayed on-screen and also ignored. Numbers in the 6th line (PL
- page length, LW - line width, MT - top margin, MB - bottom margin, LH - line
with header, LF - line with footer, HH - line of hyphens in header, HF - line
of hyphens in footer, BM - margin size; BM is internally reset to zero if 'm-'
option is used) are used to calculate column width (which is equal to: (LW -
BM) / #_of_columns - 1) and some other numbers...
FOLD-and-PRINT starts with sending control codes from line 11 to the
printer. Then for the each page it repeats:
* sending control codes from line 13
* printing PL lines of which:
** first MT lines are blank except for: LH'th line which contains header as
found in line 5 with expanded symbols beginning with '%' and HH'th line
which contains LW - BM hyphens
** next PL - (MT + MB) contain a text formatted in a number of columns of
your choice (1 to 9)
** last MB lines are blank except for: LF'th line which contains footer as
found in line 6 with expanded symbols beginning with '%' and HF'th line
which contains LW - BM margins
* printing control codes from line 14
The printing is terminated with sending control characters from line 12.
Each line of text contains a pair of CR and LF characters at the end
so you must turn off auto line feed feature of your printer if it is on.
Surely it is off --- most programs require that it is off.
It is all that you need to set up your printer. Please remember that
FOLD-and-PRINT absolutely relies on you and assumes that you configured it
correctly. If the printer prints strange things --- it is most likely your
fault! Please read 'Hints...' below for the last help on configuring.
HINTS AND TROUBLESHOOTING
-------------------------
Here are some notes which you may find helpful in configuring
FOLD-and-PRINT and if you have troubles with FOLD-and-PRINT:
* If every other line printed is full and every another is not, and
page does not fit on a single sheet, you decrease the value of line width
(line is simply too long) or change some codes to decrease character pitch.
* If line spacing is too large, turn off the auto line feed feature in
your printer or put in printer definition file some codes which decrease line
spacing.
* If a page does not fit on a single sheet of paper (eg. the footer
is printed on the next sheet) reduce the page length value or make printer
ignore the end of paper (the latter is often better --- it is possible to
print the footer at the very end of the sheet).
* When you use fanfold paper always turn off the skip over perforation
and adjust top and bottom margins.
* If you use fanfold paper and the second (and next) page(s) do(es)
not start at the same position as first, calculate page length, divide by line
spacing and put appropriate values in the printer definition file, or...
* If you use fanfold paper and the second (and next) page(s) do(es)
not start at the same position as first, calculate page length, put codes to
set this value in line 11 (printer initialization) and add FF (form feed) to
line 14.
* If you use two (or more) printers in your system and want to keep a
couple of .P files for each printer there are two solutions: 1) create a
unique names for all files (for example use some prefix for all files used by
a given printer); 2) move all .P files used by one printer to a separate
directories and use '-P' option; this is especially useful in BATch files: you
may want to create files named (for example): FOLD-EPS.BAT, FOLD-IBM.BAT, etc.
in which you SET the FOLD variable with (for example): '-Pc:\fold\epson', etc.
FINAL NOTES
===========
Some legal issues, registeration information and prices as long as
other information are not included in this part of the manual --- they are not
necessary here and may annoy someone who wants to get some help out of this
text and does not want to browse through revision history, acknowledgements,
etc. Also such information may annoy much more if you have a habit of printing
software documentation.
So please have a look at FOLDADD.DOC sometime...
End of User's Manual
********************