Twoside Version 1.0 A utility for printing on both sides of the page. (c) Copyright David Dhuyvetter 1991. All rights reserved. TABLE OF CONTENTS ----------------- Section 1 : A Description of Twoside. 1.1 Why it is. ........................... 2 1.2 What it is. .......................... 2 1.3 What it Needs. ....................... 3 Section 2 : Twoside Syntax. 2.1 Twoside at the Command Line. ......... 3 2.2 Printer Device. ...................... 4 2.3 Page Length. ......................... 4 2.4 Form Length. ......................... 5 2.5 Margins. ............................. 5 2.6 Tab Spacing. ......................... 6 Section 3 : Using Twoside. 3.1 Printing Text Files. ................. 6 3.2 Printing Word Processing Files. ...... 7 3.3 The Configuration File. .............. 8 Section 4 : It's Your Turn. 4.1 A Plea For Money. .................... 10 4.2 Come Into My Mind. ................... 10 4.3 Reporting Problems. .................. 11 4.4 Registration Form. ................... 11 Page 1 Page 2 Twoside Version 1.0 Section 1 : A Description of Twoside. ------------------------------------- 1.1 Why it is. Twoside is the program that I promised myself a hundred times I'd write. You know what I mean. . . . I had just downloaded that shareware program that I'd had my eye on. I wanted to see the documentation, but it seemed like such a waste of paper to print it out before I was sure that I was going to use the software. I tried to use the backs of old printouts, but that didn't work very well. Old printouts with bent corners don't feed well through many cut sheet printers, and tractor feed printers make reusing odds and ends of paper nearly impossible. At other times, I wanted nice permanent copies of documentation that I could bind without punching holes in the text. I kept asking myself: "How hard could it be to write a program to print text files on both sides of the page, and with margins for binding?" (Oh boy! Harder than I imagined.) The last straw was the A86 assembler. It is a _wonderful_ little assembler put out by Eric Isaacson (highly recommended), but the documentation is an epic! I wanted to make my own bound copy, but without Twoside, it would have been too big to fit in a 2" three-ring binder. 1.2 What it is. Twoside is a utility for printing on both sides of the page. I have tried to make it general enough to properly format any line- formatted plain text file on any printer. The only provision is that the printer form length and line width must be at LEAST as large as the page length and line width in the text file. Twoside can often be used to print word processor files and text files that are not formatted for printing. For this it is necessary to have a word processor that can print to a plain text file. (Most can.) Twoside can be used to adjust the size of the left margin on the printed output. The margin controls are separate for the odd pages (the front) and the even pages (the back). By using a moderate left margin on odd pages, and a small left margin on even pages, you can create a document that can be bound without the binding interfering with the text. Finally, Twoside can be used to print files formatted with nonstandard tab spacing. The tab stops on most printers are every 8 spaces. Many word processors, however, use tab stops located every 5 spaces. If a text file formatted with 5 space tabs is COPY'd to the printer, the alignment will be off. Twoside can be used to print these files with proper alignment. Twoside Version 1.0 Page 3 1.3 What it Needs. Twoside needs three things in order to work. First it needs a text file formatted for printing. Any file that can simply be COPY'd to any printer is formatted for printing. Most shareware .DOC and .TXT files fall into this category. If your file is not formatted for printing, see Section 3.2, Printing Word Processing Files. Twoside's second requirement is a printer capable of printing your text file. If the file is formatted for 132 characters per line, then your printer had better print 132 characters per line, or you're out of luck. This line length requirement includes any margin that is added by Twoside. This takes a bit of planning for some files, and is explained in Section 2.5, Margins. More importantly, if the file is formatted for 66 lines per page, and your printer only prints 60 lines per page, then Twoside might not work correctly. This problem and a possible solution are discussed more fully in Section 2.3, Page Length. Finally, Twoside needs to be able to write to the current drive. It will create a temporary file about half the size of the original text file. If you are using Twoside to print a text file on a write- protected disk, or a disk that is almost full, then you need to call the program from a drive that can be written to. For example, if you wanted to use Twoside with the file INFO.TXT in the directory STUFF on a full disk in drive A:, then assuming that there is room on the C: drive, you would make C: the default drive and type : TWOSIDE A:\STUFF\INFO.TXT This example assumes that TWOSIDE.EXE (and TWOSIDE.CNF if it exists) is either in the current directory on the C: drive, or in a directory on the path. Section 2 : Twoside Syntax. ---------------------------- 2.1 Twoside at the Command Line. The format of the Twoside command line call is as follows: TWOSIDE NAME.EXT [/de=name][/pl=#][/fl=#][/om=#][/em=#][/ts=#] /de=name -Printer port: lpt1, lpt2, lpt3, com1, com2. (Default = lpt1) /pl=# -Maximum page length in text file. (Default = 60) /fl=# -Printer form length in lines. (Default = 66) /om=# -Size of left margin on odd numbered pages. (Default = 6) /em=# -Size of left margin on even numbered pages. (Default = 2) /ts=# -Spacing of horizontal tabs in text file. (Default = 8) This syntax will be displayed whenever you type TWOSIDE without Page 4 Twoside Version 1.0 specifying a file for it to print. The order of arguments makes no difference, and they are all case insensitive. A single space may be used between each argument, but spaces are not allowed within an argument. For example: Good: /TS=5 /FL=60 or /ts=5/fl=60 Bad: / ts=5/ fl=60 or /ts =5/fl= 60 2.2 Printer Device. The /de=name argument is used to select the port to which your printer is connected. The possible ports are: lpt1, lpt2, lpt3, com1, and com2. (Notice that there is no colon after lptX.) The default is lpt1. If your printer is connected to some other port, you will probably want to use a configuration file (Section 3.3) to permanently change this default. 2.3 Page Length. The /pl= value is only important for text files that, like this one, have pre-defined pages. If you are printing a text file that does not have any page formatting, then any value less than or equal to the form length will work, and the default 60 lines per page is probably best. In any case, it is important that the /pl=# is less than or equal to the /fl=#. It is the opinion of this writer that all _reasonable_ documentarians format their text files for a page length of 60 lines or less. Some authors, however insist on formatting their text files for a page length of 66 lines per page. If your printer uses 66 lines per page, then simply include /pl=66 when you use Twoside with these files. If your printer does not print 66 lines per page, then there is no way to get these files to print correctly with Twoside or without it. Many 60 line per page printers, however can use something called text scaling to cram 66 lines into the space of 60. The finished product looks pretty crowded, but it is the only way to successfully print some files. If you are having this problem, see your printer's documentation on how to enter the text scaling mode. (It is usually accessible via a DIP switch.) A word about page formatting. . . . Some text files are formatted with form feeds, and some are formatted with multiple line feeds. Twoside ALWAYS respects form feed characters. If a file is formatted with form feeds, then as long as the /pl= number is larger than the longest page in the text file, the file will print correctly. (This also assumes that your printer is capable of printing the longest page on a single sheet of paper.) If you TYPE a text file with form feed characters, they will appear as the symbol for female. Files formatted with multiple line feeds, on the other hand, will only print correctly if the /pl= number is exactly the number of lines per page in the source text file. This will almost always be 66 Twoside Version 1.0 Page 5 lines, so you should use /pl=66 for these files. Line feed characters do not appear when you TYPE the file. Instead, each page will start or end with several blank lines. Before you print any file using Twoside, make sure that you know how it is formatted. 2.4 Form Length. If your printer prints exactly 66 lines per page, (many tractor feed printers do) then you will never have to use /fl=. Go find something more interesting to read. As for the rest of us, form length is still pretty simple. Twoside must know exactly how many lines per page your printer uses. If Twoside is not told the correct form length, the text file might not print correctly. This number depends entirely on your printer, and will not change from one text file to another. (Though it might change if you use a different font, text scaling, or change the printer's default margins.) To tell Twoside your printer's form length at the command line, simply include /fl=(your printer's form length) in the list of arguments. Since form length stays the same for all text files, and since typing command line arguments is a pain, I have made it possible for you to change the default values permanently. See Section 3.3, The Configuration File. This will allow you to set the form length for your printer one time, and never bother with it again. 2.5 Margins. One of the reasons for printing on both sides of the page is to make nice copies of text files that you can have bound. Unfortunately, many printers (like mine) only give a quarter inch left margin when you COPY files to them. Most methods of binding require a larger margin than that. Even if you just use a three-hole punch, chances are pretty good that you will end up punching out text. Twoside's solution to this problem is to allow you to define margins for the odd pages (the front) and the even pages (the back). By defining a moderate margin for the odd pages, and a small margin for the even pages, the text is shifted away from the edge of the paper that is used in binding. The margins are controlled with the /om=# and /em=# values. The # represents the number of blank spaces starting each line on the odd pages and the even pages respectively. If you use a 10 cpi (characters per inch) printer or font, the defaults of 6 spaces for odd pages, and 2 spaces for even pages should allow enough room on the page for whatever binding method you use. If your printer uses some other pitch, then you will probably want to adjust the defaults. You can use the configuration file (Section 3.3) to permanently set these values to whatever seems best to you. The size of margins that you can successfully use depends on the line length in the text file, and the line length that your printer can print. Most printers can print at least 80 characters per line. Page 6 Twoside Version 1.0 On many printers 80 character lines will have a quarter-inch margin on either side. Since quarter-inch margins give a document an uncomfortably crowded look, many text files are formatted for much shorter lines. For example, this file is formatted for lines of up to 70 characters, so that a comfortable margin may be used on the left and right. When Twoside prints a file, the margins are added to the source file's line length. If the source file has lines of up to 80 characters, and your printer can print at most 80 characters per line, then you should set both odd and even margins to 0. (/om=0/em=0) If you don't, then your printer will do whatever it does when it is asked to print a line that is too long. (Some wrap, some truncate, and some blissfully continue printing right onto the platen.) If your printer wraps the line, (many do) then there is a good possibility that the page formatting will be destroyed. One solution to this problem is to use a different font. If your printer has multiple fonts, chances are good that at least one of them can be used to print more than 80 characters per line. Since margins are made up of spaces, the margins will become smaller if you select a font with a smaller pitch. You may want to increase the numbers for /om=#/em=# if you use 12 or 16.67 pitch. My personal solution is to ignore the problem and let my printer truncate oversize lines. (As mentioned earlier, this won't work if your printer wraps oversize lines.) I figure that anything printed so far down the line can't be too important. It's also a personal act of opposition to authors who format at 80 characters per line. If their writing is that dense, then their text files probably aren't much fun anyway. :) 2.6 Tab Spacing. You probably won't ever have to use the /ts=# value. I included it because I had to define tab spacing for the program, and it wasn't any problem to make it a variable. The only use for the tab spacing value is if you should happen to have a file formatted with tabs (ASCII - 09) and the formatting assumes that the tabs are some number other than 8 spaces apart. If you should happen to have such a file, tell Twoside the tab spacing you want by using the /ts=# value. Section 3 : Using Twoside. -------------------------- 3.1 Printing Text Files. Text files are files containing only ASCII characters and control codes. In addition, text files that will work with Twoside will be "line formatted." They will have explicit ASCII carriage return and line feed characters at the end of each line to be printed. Most text Twoside Version 1.0 Page 7 files distributed with software fit this description. If you are trying to print a file that does not fit this description, then see Section 3.2, Printing Word Processing Files. Twoside was written to work with text files, so they are easy. To use Twoside with a text file named INFO.TXT, you would simply type: TWOSIDE INFO.TXT [any command line arguments you want] Twoside will Display a short message, and start sending the odd pages of your file to the printer. Some time later, probably before your printer stops printing, it will display the message: Set up printer for side two. Press Enter to print. KEEP YOUR FINGERS OFF THAT ENTER KEY! If you hit Enter before you arrange the paper, then you won't get the chance to print on both sides, and you will end up with a very nice, decollated, one-sided printout. When the printer stops, feed the printout back into the printer so that it will print on the back of the first sheet, followed by the back of the second sheet, etc. (This may be trickier than it sounds.) For tractor feed printers, once you get it started right, you're home free. Be sure to leave at least one blank sheet at the end of the printout so your printer won't think it is running out of paper when it prints the last page of side two. For cut-sheet printers, you may have to reverse the order of the pages, or you may not. You might also have to turn the stack over, or maybe each page needs to be turned over. If you're not sure how to do it, practice with short (4 page) files until you get the hang of it. In any case, once you've arranged the paper, press Enter and Twoside will print out the even pages. Often, an extra page will be fed through the printer at the end of printing the odd or even pages. This is to accommodate certain file/printer combinations, and should not cause concern. 3.2 Printing Word Processing Files Word processing files cannot be used directly with Twoside. They usually contain formatting information that is only understood by your word processor. Fortunately, many word processors have a method of creating text files that Twoside can use. Word processors can also be used to convert text files that are not line formatted into text files that are ready to be printed. Most word processors can "print" a document to a file. What they really do is to produce a text file that can be COPY'd to the printer. This is probably the best way to prepare a word processing document. Use your word processor's Print to File command to create a file that you will print using Twoside. If you want to use Twoside with a text file that is not line formatted, then open the text file in your word processor, and print it to file just as you would print a word processor document. You must use as generic a printer driver as possible when Page 8 Twoside Version 1.0 creating the text files. Most word processors can print to : Generic (Text Only), Teletype, or TTY printers. Any of these would be a good choice. Other choices _might_ work, however they could cause trouble. Twoside recognizes only standard ASCII formatting commands. Specialized printer drivers often use nonstandard control characters to send formatting information to the printer, or they might even switch the printer into graphics mode. Twoside will pass these commands to the printer, but it won't know what they mean. This could cause a mild problem, like overriding Twoside's odd and even margins, or it could lead to a serious problem like mismatched pages. (A mess!) It is important that the page length defined in your word processor can be printed by your printer, and matches the /pl=# used for Twoside. The problem with this is that page length is usually defined in inches for your word processor, and it is defined in lines for Twoside. If your printer has a form length of 60 lines per page, then lie to your word processor and tell it that it is printing on 10" long pages. You might want to reduce or eliminate the top and bottom margins as your printer probably provides these anyway in the form of half-inch default margins at the top and bottom of each page. Use /pl=60 when using Twoside with the text file that you create. If your printer has a form length of 66 lines per page, then your word processor's defaults are probably correct. Use /pl=66 when using Twoside with the text file that you create. If you want to use Twoside's ability to define different margins on the front and back sides of the page, then tell your word processor to use a 0" left margin before you print to file. You might want to tell your word processor to use an extra large right margin in order to leave room for the margin that Twoside will add. When I use this technique, I set the left margin to 0", and add the default left margin to the right margin. In that way, Twoside can control the margins, and the line length is the same as with the default margins. If you just want to use the word processor's margins when the document is printed, then leave the left and right margin definitions in your word processor alone, and include /om=0/em=0 in the Twoside command line. This is the easiest method if you don't want the text shifted away from the binding edge. Be sure to give the file that you create using the Print to File command a different name from your word processing document. In that way, you will still be able to easily access the document in the word processor. Once you have created a text file, use Twoside as explained in Section 3.1, Printing Text Files. 3.3 Configuration File As Twoside developed, the list of command line arguments grew, and it became harder to use. (I always get command line arguments wrong when I use programs.) Also, the /fl=# and the /de=# values don't change unless you change your printer or port. It would be a waste if those of us with 60 line printers had to use /fl=60 each time Twoside Version 1.0 Page 9 we used Twoside. Twoside's solution to this problem is to allow the user to define a configuration file which permanently changes the default values to whatever you want. The configuration file must be named TWOSIDE.CNF, and it must be in the current directory when you use twoside. If you write a configuration file, then Twoside will use MY defaults when you use it in any directory other than the one containing TWOSIDE.CNF For example, if TWOSIDE.EXE and TWOSIDE.CNF are in the directory C:\STUFF, you can call Twoside from the B: drive using the command: B:\> C:\STUFF\TWOSIDE INFO.TXT Twoside, however will NOT be able to find the configuration file in this example. If you wish to use the configuration file, you must either copy TWOSIDE.CNF into B:\, or call twoside from C:\STUFF using the command: C:\STUFF> TWOSIDE B:\INFO.TXT Writing a configuration file is simple. It is one of the few tasks for which you can actually use COPY CON. The configuration file is simply an ASCII file containing any argument values that you want to be defaults. You can use any text editor to create it, but it is simple enough to do without a text editor. Here is an example of creating a configuration file: C:\> COPY CON TWOSIDE.CNF /fl=60/om=8 <-- Use YOUR favorites on this line. ^Z 1 file(s) copied C:\> In the above example, means press the Enter key, and ^Z means hold down the Ctrl key while you press Z. To see that your new default values are installed, type TWOSIDE without a file for it to print. The help screen should display the values that you selected. If your values are not displayed, make sure that you successfully created the file, and that it contains the values that you want. Twoside will use MY defaults unless it can find the file TWOSIDE.CNF. If it can find the file, then any values in that file will override my defaults. Command line arguments override ALL other values, so you can still use them if you have a configuration file. Page 10 Twoside Version 1.0 Section 4 : It's Your Turn. --------------------------- 4.1 A Plea For Money. Twoside is copyrighted software. You are permitted to use unregistered copies of this program for evaluation purposes only. You are encouraged to distribute this program to friends (and strangers!), but if you do so, you must include the unmodified files: TWOSIDE.EXE, TWOSIDE.TXT, and README.1ST. Twoside isn't freeware, but it sure is cheapware. The registration fee for this gem of a program is a paltry $10. Once you have evaluated Twoside and realized that you can't live without it, _please_ send in the registration fee so I don't lose faith in the shareware concept and start working for a company that would charge you $40 for a simple utility like Twoside. You will find a registration form on the last page of this document. 4.2 Come Into My Mind. Many shareware authors hold a part of their program hostage to the registration process. They distribute an emasculated version of their program, and only individuals who register get the full version. I chose not to do this for two reasons. First, I _hate_ spending time downloading, printing documentation, and generally figuring out a program only to discover that the version I have doesn't let me get a feeling for what the registered version is like. I usually get very frustrated with these programs and end up deleting them and vowing never to register anything with that author -- ever! I wanted you to see what Twoside is really like, and how easy it is to use. A second, and perhaps a more important reason is that there is no way that I could send a disk to each registered user without raising the price. Software costs too much, and I don't want Twoside to be part of this problem. By distributing the complete version as shareware, I am doing what I can to get quality software into the hands of users for a reasonable price. I hope that I can continue to distribute complete versions of programs at reasonable prices. You can support this by REGISTERING your copy. It's a painless process, and the alternative (commercial software) is much too expensive. Problem Reporting Form ---------------------- I accept problem reports from _anyone_ (registered or not) and will do my best to fix any reported problems in subsequent releases. Before you report any problem, make sure that you are working with a plain (no printer specific control codes) text file that prints correctly when COPY'd to the printer. Twoside _might_ format some files with specialized codes correctly, but it was only designed to print ASCII text files. Printer type :_____________________________________________________ Text file name and source (if shareware) :_________________________ ___________________________________________________________________ Describe problem :_________________________________________________ ___________________________________________________________________ ___________________________________________________________________ Send this report to : David Dhuyvetter 1272 W. Arrow Hwy., #49 Upland, CA 91786 Thank You! ................................................................... Registration Form ----------------- In order to register your copy of Twoside, please fill out this form, and send it with $10 to: David Dhuyvetter 1272 W. Arrow Hwy., #49 Upland, CA 91786 Name :__________________________________________________________ Address :__________________________________________________________ __________________________________________________________ __________________________________________________________ Where did you get Twoside? ________________________________________ __________________________________________________________ Thank you!