home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PRINT
/
PRNF245.ZIP
/
PRN2B222.EXE
/
PRN2BOTH.DOC
< prev
next >
Wrap
Text File
|
1993-07-26
|
21KB
|
336 lines
________PRN2BOTH v. 2.22
Purpose: Prepares an ASCII text file for printing on both sides of the
paper by copying it to two files, one containing the odd and the
other containing the even pages. Its intended use is on files
which have been formatted for printing with FF's (the form-feed
character, ASCII #12) or by the proper number of blank lines to
fill out the bottom of the page.
Format: PRN2BOTH [[filespec] [/L[#]nn] [/Mnn,nn,nn] [/Rn[,n[,n[,n]]]]]
[/A] [/N] [/?]
All you really must enter is PRN2BOTH. Any option you don't spec-
ify on the command line will be asked for interactively.
________ filespec may contain drive and path specs, but not wildcards.
____ /Lnn specifies the maximum page length. If a form-feed is found
in the first page (that is, in the first nn lines), Prn2Both
will ignore your spec and go by form-feeds. If none are found
in the first nn lines, Prn2Both will (a) insert FF's every nn
lines, and (b) convert any FF's it finds into nulls (ASCII
#0). If you do not specify a page length it defaults to 63,
but you get a chance to change it.
___________ Note change: page length specifications must now start with
/L. (In earlier versions, they just started with /nn.)
___ /L# says the file is self-paged with blank lines. In this case,
Prn2Both inserts no FF's and converts any it finds into nulls.
By itself, /L# gives you 66 lines per page. Putting a number
with it: /L#nn tells Prn2Both that the file is designed to
page itself every nn lines. Prn2Both will break the pages
that way, nulling any FF's it finds and inserting no FF's.
_______ This is not normal practice; it implies that the printer gets
nn lines per page. It might be used with a laser printer or
for a file designed to be printed at 8 lines per inch (88 per
page) or meant for legal or European paper sizes.
_______ /Mn,n,n three numbers specify the margin layout: the 1st is the
left margin on odd pages (the right margin on even pages), the
2nd is the width of the text (If you don't know the width,
CountPgs will tell you), and the 3rd is the paper width, how
many columns the printer puts on a line in the font you intend
to use. (You must begin this parameter with '/', but you can
separate the numbers with anything you like except a space.)
"Margin" here means margin added by Prn2Both. If there is al-
ready a margin in your text, Prn2Both won't know it, so you
must take it into account yourself, or remove it with Mangler.
_________ /Rn,n,n,n Reverse header/footer lines on even-numbered pages. The
first number says how many header lines and the second how
many footer lines.
________PRN2BOTH Page 2
If there's a third number, it will become the width (in col-
umns) of blank space that will be taken to indicate separate
header segments. That third number also adjusts the distance
between the line ends and the left and right header segments.
(If more than so many columns are blank at either end of the
header, Prn2Both will take it there's no end segment on that
side.) The default divider width is 4, and the end space is
always half-again the divider width (rounded down).
If there's a fourth number, Prn2Both will use it for the head-
er width. If there isn't a fourth number, headers will be
presumed to have the same width as the text. By juggling the
header and divider widths, you can sometimes perform surgery
on a header line.
On each page, Prn2Both will set out to reverse as many lines
_________ as you specified, counting from the top non-blank line on the
page, but it will stop reversing on that page if it finds a
blank line first. It does the same for footers, but counting
from the bottom non-blank line up.
Even a file that uses headers and footers may contain pages,
like the title page, that lack them. If Prn2Both finds no
text within 6 lines or so of either end of the page, it pre-
sumes there's no header/footer at that end of that page. At
the top of the page, this usually works, but files paged with
FF's, usually put the FF right after the last line, whether
it's a footer line or not. To avoid reversing the last line
of such a page, you'll have to insert some blank lines between
the last line (when it's not a footer) and the FF.
The /R option cannot be used if the file has its own margin
built in, and you get a warning if Prn2Both finds such a mar-
gin. If you want to reverse header lines, you should remove
the margin with Mangler. It's a good idea to do this anyway;
it's much easier to explain to Prn2Both what margins you want
if you don't have to allow for a margin already in the text.
To find the size of the margin, use CountPgs.
__ /N means "No split." It puts all the output into one file,
XXX.OUT, instead of dividing it between XXX.ODD and XXX.EVN.
(This option is available from the command line, only.)
__ /A means "Reverse All." It reverses lines in all pages instead of
only in even-numbered ones. You'd need to do this when the
lines are reversed wrong (reversed on odds and not on evens),
as might happen if you add or remove blank pages. (This op-
tion is available from the command line, only.)
__ /? cancels everything else & brings a help screen.
Under the L# option, if the end of the file doesn't come out even
with the page length specified, Prn2Both will add blank lines to
even up the end of the last page. In any case, if XXX.EVN has
fewer pages than XXX.ODD, Prn2Both gives it a blank extra page.
________PRN2BOTH Page 3
Remarks: Prn2Both reads the file you specify and outputs two files with the
same filename and the suffixes ".ODD" and ".EVN". It puts them in
the default drive\directory. Give it C:\DOCS\FOO.DOC, and you'll
get FOO.ODD and FOO.EVN. Essentially, you copy FOO.ODD to the
printer, take the paper out, put it in again other way up, and
copy FOO.EVN to the printer. Be careful to make sure that the
first page in FOO.EVN (it should be the 2nd page) prints on the
back of page 1 from FOO.ODD.
What Prn2Both does is copy from the source file into the target
files. The only characters it notices are the line-feed (LF,
ASCII #10), form-feed (FF, ASCII #12), and end-of-file (ASCII
#26). Whenever it finds an LF, it counts a line. When it finds a
form-feed or counts out the page length you specified, it switches
to the other target file. End-of-files, it nulls out. Asked to
insert margins, it will watch for bare carriage-returns (CR, ASCII
#13) and insert margin spaces after them, too.
Except for its margining feature and its ability to reverse header
and footer lines, Prn2Both isn't a formatter or paginater. Given
a continuous file without page divisions, Prn2Both will break it
into pages, of course, but they won't be numbered, they'll lack
headers, footers, top and bottom margins, and you take the page
breaks you get. To print a file properly, you need to know cer-
tain things about it. How wide are the lines, and do the pages
already have a margin built in? That determines what printer font
you'll want and whether you should set up the printer to add a
margin. Prn2Both doesn't give you any such information. It's
part of a set, meant to be used together. These are the other
programs and (briefly) what they do: (1) PrnSet is a universal
printer setter. You need a printer setter, but any will do if it
fits your printer. CountPgs sizes up a text file and gets the
information you need for working with it: whether the file is al-
ready paginated, the number of pages, their length & width, wheth-
er it contains tabs, bare CR's, hi-bit characters (graphics for
instance), etc. Pagina paginate text files and make headers &/or
footers. Finally, Mangler has a miscellany of functions you may
____ need to massage the file into shape. You usually need to look at
the file to to see about headers and such, and you may need to go
in with an editor to adjust page ends and such. For looking at
the file, several free or cheap file viewers are available; the
____ best of them is Vernon Buerg's List. The main advantage of a pro-
gram like that is that you won't inadvertenly alter the file. If
you must use an editor, be careful. It must be able to work with
plain ASCII files. Further, if the file contains bare carriage
returns to make boldface and underline (CountPgs will tell you if
it does), beware of text editors that remove them or take them for
newlines. Editors which leave CR's alone are scarcer than you'd
think. Finally, if you want page 1 to be a right hand page, you
may need to insert some extra FF's after the title page and table
of contents. The easy way to do it is with an editor if you have
a suitable one. In case you don't, both Pagina and Mangler have
provision for inserting extra blank pages.
________PRN2BOTH Page 4
Other shareware or public domain programs also handle printing on
both sides of the page. Two I know of are BOTH by Peter F. Feld-
mann and David Birley's BOTHSIDES. Prn2Both began as a quick-and-
dirty job to do something they don't (or didn't when I wrote Prn2-
Both): it's usable on files which make special effects (boldface,
underline, etc.) by using bare carriage returns or by means of
special printer instruction codes inserted into the text. The
trick is simply to divide lines on LF or FF instead of CR.
About Margins:
Margins for files printed on both sides of the paper are tricky.
Sometimes, you can simply center the text in the page. Usually,
you want to leave a little more margin on the inside --the left
side of the odd pages and right of the even ones. If you mean to
use small print and put your text onto narrow paper, you use a
normal margin on the odd pages, but you must put enough margin on
the even pages to push the text all the way over --the margin you
_____ really care about is the one on the right side of the even pages.
To work it out, you need to know (1) how much left margin you
want, (2) how wide the text is (CountPgs will tell you) and (3)
how wide the paper is (that is, how many characters per line the
printer will put in the font you're going to use). Prn2Both will
ask you for these numbers and do the arithmetic for you. You en-
ter the figures in the boxes and then press Ctrl-Enter to move
along. It will start you with the default figures: 0 margin, 80
column text width, 80 column paper width.
If you don't want to add margins (if you've set everything cor-
rectly with Pagina, for instance), you can just leave the default
_____ width values alone, provided you don't ask for reversed headers.
(In such a case, any setting will do, so long as margin = 0 and
text width = paper width.) If you want to reverse headers or
footers, however, it's important (a) that there be no margin al-
ready in the text and usually (b) that Prn2Both know the true
width of the header (it can correct for an underestimate, but not
for an overestimate). If either of these is incorrect, you may
get some peculiar headers. If you call for a reversed header from
the menu, you'll be asked for the header width.
Both Pagina and Prn2Both can make margins. If you have an unpag-
inated file to print, you'll want to run it through Pagina, any-
way, and maybe jigger the result with an editor. It's probably
better to do the margin making with Pagina, because you can set
them up with the rest of the header and formatting instructions in
the .HDR file. If your file is already paginated, however, you'll
need to do the margining with Prn2Both.
________PRN2BOTH Page 5
Sheet-Feeders & Page Order:
If your printer has to stack the pages print side up (e.g. HP's
Desk Jet), it will collate backwards. Reversing the order of the
pages before printing fixes it. Backwards backwards is forwards.
To print on both sides of the paper, after Prn2Both has split the
file into odd and even paged files is simple enough on the usual
dot-matrix printer that uses continuous-feed paper. If you make
sure to leave an extra sheet at the beginning of the text it's
pretty inuitive to turn the paper around so the first page of the
second file goes on the back of the first page of the first file.
With a sheet-feeder, however, it's a little tricky.
If the printer must stack its output print side up, as the HP Desk
Jets do, printing even on one side is complicated. A straight run
leaves you with a backwards-collated printout. Prn2Both has no-
thing for you, of course, but Mangler can reverse the order of
pages in a file. Stacking a reversed file print side up leaves
you with page 1 on top, facing up. To print on both sides of the
___ paper with such a printer, reverse the odd paged file but not the
even paged file. Print either of them, turn the paper around so
it goes in head first, and print the other file on the back. (Re-
______ member: the new print goes on the bottom of the paper as it lies
in the feeder tray).
If the printer does collate properly by stacking the output print
side down, you don't need to reverse a file. It is important,
however, to print the even pages first and the odd pages on the
back.
___ I don't know of a printer that puts the print on the top of the
paper as it comes in. If yours does, of course you'll have to re-
verse the instructions above. More or less.
A Note About Colors:
PrnSet (2.80 and later) has an option to customize its colors.
(From PrnSet's main menu, press F3.) If PRN2BOTH.EXE is on the
default drive & directory when you run PrnSet's color changer, it
will change Prn2Both's colors to match.
Lacking a copy of PrnSet, if you know how to use DEBUG or a disk
editor (like Peter Norton's NU), you can change the bytes in the
___________ file directly. Search for the flag, "COLORS:". Immediately after
the colon are 4 bytes specifying colors, in this order: Normal,
Emphasized, Frame, and Reversed. To set up for black-and-white, I
suggest you make them (in hex numbers): 07 0F 07 70 for white-on-
black, bright-white-on-black, white-on-black, black-on-white.
________PRN2BOTH Page 6
Version History:
1.10 (July, l989) adds margining. Smarter & slower.
1.20a (Aug, 1988) allows all parameters including margins to be
entered at the command line. Smoothed interaction some.
Yes, there was a plain Prn2Both 1.20, but unfortunately, a
copy er, um, escaped prematurely.
2.00 (Dec, 1989) allows even-page headers to be reversed. Now
thinks lines & pp instead of chars. Smarter & slower.
2.00a (posthaste) fixes small bugs in output of odd lines
(bare FF's and such) & a memory management bug that caused
2.00 to refuse to run except on my (former) test files.
2.00b improves centering in headers & footers & limits head-
er and footer reversing to lines near the ends of the page.
2.00c fixes errors in paging with reversed footers and also
(I think) a nasty little intermittent loop.
2.01 (Still Dec, 1989) adds options /A (reverse header lines on
_ All pages instead of only on even numbered ones) and /N (do
_ Not Split the file). Another swat at that nasty little in-
termittent loop. 2.01a has a better line-reversing algo-
rithm. Everything not abutting the line ends is clumped in-
to a single center segment. 2.01c stops better (less likely
to hang on Ctrl-Break). 2.01d (Mar, 1990) reverses properly
around a 1-chat center section.
2.10 (Apr, 1990) (1) allows choice of divider width for header
sections, and (2) asks for header width if reverse headers
requested from the menu. 2.10a (June, 1990) fixes bug about
ragged files. 2.10c (April, 1991) makes the command line /M
and /R work properly. (I forget what 2.10b did.)
2.11 (Jan, 1992) Makes use of a new line-reading function. If
all's well you'll never notice, but changing the version
number makes it easier to keep track of bugs.
2.20 (June, 1992) Makes use of that function properly. Now,
Prn2Both can handle lines of up to about 3000 characters.
Formerly, it was limited to lines of 255 characters (includ-
ing segments with underlining &c following bare CR's). Also
has a bug fix about 0 margin specified on the command line.
2.21 (Oct, 1992) Bug: Turbo Pascal's reset balks at read-only
non-text files. Works around that by using text files or
temporarily changing attribute of file. 2.2la (Dec, 1992)
uses a better way to read read-only files. 2.21b (Feb,
1993) fixes bug in margins for 1-char lines.
2.22 (July, 1993) Added help screen on /? parameter.
R. N. Wisan, July, 1993
37 Clinton Street, Oneonta NY 13820
internet: wisanr@hartwick.edu