home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
printer
/
printdoc.arc
/
PRINTDOC.DOC
next >
Wrap
Text File
|
1988-04-23
|
16KB
|
322 lines
------------
----------------------------------> PRINTDOC <----------------------------------
----------------------------------> (v. 2.1) <----------------------------------
------------
written by
Phillip Garding
663 E. Mansfield Ave.
Salt Lake City, UT 84105
u-pgardi@sunset.utah.edu.UUCP or utah-cs!utah-ug!u-pgardi
---------------------------->>Statement of purpose<<----------------------------
Printdoc is a utility for printing text files on both sides of
sheets of paper. Gone will be the days of using 64 sheets of paper to
print a 64 page manual; now it will consume only 32 sheets. The
mechanism used is to print all of the odd numbered pages on the printer,
and save the even-numbered pages to a file, pause, allowing the operator
to remove the paper, turn it over, and then print the even-numbered pages
on the back sides. In addition, Printdoc also has the ability to insert
page breaks (headers and footers) into a long text file that would otherwise
print out as a continuous sheet of text. The operation of Printdoc can be
modified to accomodate any length sheets of paper, although the default
value is the standard 8 1/2 x 11 size.
For best results, use an older ribbon, since new ribbons usually
print an image dark enough to show through to the other side of the paper
and to obscure text that may be printed there. If it is important to have
a dark copy, use a heavy stock paper that won't let the print show through.
It is essential to preview the file on the screen before printing,
so that the parameters may be correctly set, and anomalies such as title
pages, etc. can be planned for. To know more, keep reading . . .
------------------------>>Requirements and assumptions<<------------------------
Printdoc requires that:
- there is space in the current directory equivalent to at least
one-half of the size of the text file to be printed
- the source file must be ascii
- all lines of text are terminated by a "new-line character" (CR)
(i.e. the end-of-file marker must not be on the same
line as text)
- no file by the name of "---hi---.you" can exist in the current
directory (why would you have a file with a name like
this anyway?), since the even-numbered pages are stored in
a created file of this name.
--------------------------------->>Invocation<<---------------------------------
Printdoc can be invoked with the name "printdoc", and the file
to be printed can be given as a command line parameter.
For example: "printdoc manual.txt".
If the file is not specified on the command line, printdoc will prompt
for the name of the file. The filename string cannot be longer than 64
characters, and can include a path, as well as the file name.
For example: "printdoc c:\swamp\land\sales\howto.doc".
---------------------------------->>Options<<-----------------------------------
When Printdoc is run, after the filename has been recognized,
and the file found and opened, you will be asked if you would like to
view and/or change the parameter settings. A response of 0 will accept
the default settings, but by responding 1 to this query, a menu showing
the four settings and their default values will be shown. Choosing the
number to the left of a parameter will allow you to read a description
of that parameter's function and allow you to change its value. The
various parameters are discussed below.
*-**-***-*****-********-*************-*********************-**************...
Parameter: page size
Default setting: 66
Description: The page size is the number of lines that
can be printed on one page. For a standard
8 1/2 x 11 inch sheet, this is 66 (the
default). For a legal sized sheet of paper,
8 1/2 x 14 inches, the value is 84. To
calculate the number of lines for an
arbitrary size sheet, multiply the length in
inches by 6.
Setting Options: new value, or enter 0 for default (66).
*-**-***-*****-********-*************-*********************-**************...
Parameter: line width.
Default setting: 80
Description: The line width is the maximum number of char-
acters that will be read by printdoc for one
line. If the document has lines greater than
80 characters, this parameter must be set to
the GREATEST EXPECTED value. Note: this value
does not include the CR at the end of the line.
Setting Options: new value, or enter 0 for default (80).
*-**-***-*****-********-*************-*********************-**************...
Parameter: text mode
Default setting: pica
Description: The text can be printed on the printer in a
variety of pitches. The codes used are
standard Epson/IBM printer codes. Pitches/
modes available are pica, elite, condensed,
near-letter quality (on my STAR, this is
always 10 char/inch, but may vary on other
printers), and custom. For the case of custom
text mode, the user enters the decimal values
of the printer codes he/she wishes to send to
the printer. CHOOSING ELITE AND CONDENSED WILL
CHANGE THE SIZE OF THE LEFT MARGIN. It is
assumed that a margin is desired (for hole-
punching, etc.); elite and condensed set the
left margin for 1 inch. If this is not desired,
it is necessary to reset the left margin
parameter after selecting the text mode.
Setting Options: 1. pica (10 char/inch) ESC - P
2. elite (12 char/inch) ESC - M
3. condensed (17 char/inch) ESC - <SI>
4. near-letter quality on ESC - x - 1
(off ESC - x - 0)
5. custom
*-**-***-*****-********-*************-*********************-**************...
Parameter: printer device.
Default setting: prn.
Description: This is the dos device name to which your
printer is assigned.
Setting Options: 1. prn
2. lpt1
3. lpt2
*-**-***-*****-********-*************-*********************-**************...
Parameter: Left margin.
Default setting: 0
Description: This is the size of the left margin INSERTED
by printdoc. This value does not include any
margin that may be built into the document to
print. Note: selecting a text mode of elite
or condensed will cause this value to be set
to a one-inch margin (12 for elite, 17 for
condensed. If this is not the size margin
desired for one of those pitches, it is
necessary to choose the text mode, then reset
the left margin value.
Setting Options: New value, or 0 for current value.
*-**-***-*****-********-*************-*********************-**************...
Parameter: Page breaks
Default setting: yes
Description: A page break is a set of blank lines used to
separate one page from another, and to put a
margin at the top and bottom of a page of
print. The page break parameter tells
Printdoc whether the source file has blank
lines in it already, or whether Printdoc must
put in headers and footers for each page.
In the default case, Printdoc IS EXPECTING
page breaks to already exist. If the default
setting is changed to no, then Printdoc will
print blank lines at the top of each page,
count and print the number of lines of text
for one page (page size - (header + footer),
then fill in blank lines to complete the page.
Setting options: Enter 1 for yes or enter 0 for no.
*-**-***-*****-********-*************-*********************-**************...
Parameter: Header size.
Default setting: 3.
Description: The header is the number of blank lines printed
at the top of a page. The default setting is
3 lines, which equals 1/2 inch. This parameter
is used only if page breaks is no.
Setting options: Enter new value or enter 0 for default (3).
*-**-***-*****-********-*************-*********************-**************...
Parameter: Footer size.
Default setting: 8.
Description: The footer is the number of blank lines printed
at the bottom of a page. The default setting
is 8 lines, which equals 1 1/3 inch. This
parameter is used only if page breaks is no.
Setting options: Enter new value or enter 0 for default (8).
*-**-***-*****-********-*************-*********************-**************...
Parameter: Page numbers.
Default setting: yes.
Description: If page breaks are to be inserted, printdoc
can also print page numbers at the bottom of
each page.
Setting Options: Enter 1 for yes, enter 0 for no.
*-**-***-*****-********-*************-*********************-**************...
---------------------------->>Reversing the paper<<-----------------------------
After Printdoc has printed all of the odd numbered pages and stored
the even-numbered pages into the file "---hi---.you", it will pause, asking
that you remove the paper from the printer, turn it over and realign it with
the top of the first page under the print head. When the printer is ready,
hit the return key.
This sounds incredibly easy, but it is amazing difficult to do
correctly. In testing and debugging Printdoc, I have probably uncovered
all of the ways to do this operation wrong. Watch out for the following
mistakes:
- Refeed the paper with the already printed side up, so that
page 2 prints over page 1, etc. The result is that you can
print four pages on one sheet of paper, two on each side.
Unfortunately, you can't read any of it.
- Start printing the even-numbered pages on the back of the
wrong odd-numbered page (page 4 goes on the back of page 1,
page 6 on the back of page 3, etc.)
- If the manual has a title page, it does not properly count as a
"numbered page", so instead of the odd numbered pages being
printed, the even-numbered pages are printed in the first
run. If you don't want page one to begin on the back of the
title page, then start printing on the back of the SECOND
sheet (page 2).
- If the manual has a title page, it may also have a second
"unnumbered page", (such as a statement of copyright, intro-
duction, etc) in which case you will have to print this page
on the back of the title page. This situation is unexpected
because the second "unnumbered page" isn't visible; it is in
the pages stored on the disk. The only cure for this is to
inspect the document before you run Printdoc, so that you
know what is coming.
- If the manual has a title page, and you wish to start the document
on a new sheet of paper, and if the length of the document is
odd, then it will be necessary to leave an extra blank sheet
at the end of the first run, since the first run is printing
the even pages, and there is one more odd page than even pages.
- Don't forget to leave a page for the tractor feed to pull all of the
pages through the printer. If your printer uses a pulling
tractor feed (sprockets pull paper after it has passed under
the print head), leave a page in front, and if your printer
uses a push tractor, leave an extra sheet after the last page.
--------------------->>Miscellaneous thoughts and warnings<<--------------------
Keep the following in mind when using Printdoc:
- It will always be worth the effort to examine at least the first few
pages of the document on the screen before printing. This way
you can see if the file has page breaks, or if there is a
title and other pages that deserve special treatment.
- In previewing the document, watch for "form feed" characters. These
will appear on the left column as a graphics character (often
resembling the "male" symbol, a circle with an arrow coming
out of the bottom. Form feeds are handled by printdoc, and not
by the printer. In my experience, a document with form feeds
is organized using the form feed character for a page break.
A page break may be there without having explicit blank lines.
- If the document doesn't have page breaks, and Printdoc is inserting
blank lines, it may make the page layouts look strange. As
an example, it may put a section head at the bottom of one page
but print the text of the section on the next page, or a table
may be artificially split onto two pages, etc. Remember, all
that Printdoc is doing is counting lines; it has no idea what
those lines contain.
- If the layout of the document is important, it may be worthwhile to
edit the file first, and place your own headers and footers,
so that continuity is maintained.
- Before printing the other sides of the pages, look at how the
odd-numbered pages printed. One software manual that I had
printed had one page too short, so everything after that
page was half on the one sheet of paper, and half on another.
This will save the time, frustration and printer ribbon
expense of printing the even-numbered pages when the odd-
numbered pages have an error.
- Remember to save old printer ribbons, since a new ribbon will
usually go through a light stock paper, which printer paper
tends to be. For best results, use an older ribbon, or buy
heavy paper that won't let the print show through.
- Most documents are 80 columns wide, and in standard print modes
(pica), 80 columns leaves little room for side margins. If
a margin is important (for punching holes to put the document
into a binder, for instance), try setting your printer into
a narrower print font (elite or condensed) or center the line
of text as best as possible on the page. A narrow left margin
on the "odd pages" will also print with a narrow left margin
on the "even side", except that the left margins on the two
sides of the page are not in the same place. (Are you
confused? Just try it; you'll see.)
---------------------------------->>Begging<<-----------------------------------
I wrote printdoc for my own use, and I want to share it with others.
I have no serious intention to make my fortune from selling this program,
but I am a computer science student on a budget, and I certainly wouldn't
refuse if a payment was sent to me for writing this program. So if you have
some extra change in your pocket, why not pop it in an envelope, and mail it
to me. You'll never miss it, and it may allow me to buy one of four $50
textbooks that I use each quarter. Please don't send any more than $50,000,
however, as I would have to declare it on my income tax.
If you are a student, and you use this program, I expect no payment.
If you are gainfully employed, however, I am asking $4.00.
Any paying users of this program will be put on a mailing list, and
revisions of the program will be sent to them. (Planned additions include
adding a comment (such as the name of the file) in the header of each page,
and allowing multiple files to be specified on the command line, which will
be printed in the order they are listed.)
Thanks, and I hope that you enjoy Printdoc.