NAME BindBook - a package for creating bound, glued, and folder books SYNOPSIS bindbook -[BCGF] [flags ...] [file | -] ... INTRODUCTION BindBook accepts one or more Structured PostScript files (see Glossary), each containing a number of pages, and produces one or two PostScript files which will print these pages two to a page double-sided, to produce books in various formats. These include books with signatures, two-up reports and "half-size" books. The "two-to-a-page" format means that the original pages were to be read portrait-wise and that the resulting printed page is to be read landscape-wise; it contains two of the portrait pages side by side, of reduced size. The font size will be reduced to 71 % of its original value by this procedure. If you are using the metric paper size system and are starting from A4 pages, the resulting pages will be A5. The pages in "half-size" books are even more reduced and are half as wide and half as high as the originals. This will reduce the font size to half its original value. The result will be an A6 book(let). The program requires you to have a source of Structured PostScript and a printer which either can print two-sided or allows you to reinsert the stack of paper just printed to print on the other sides. Caution: some printer types are damaged by having them print on paper which already has toner on it -- check your printer manual. Sources of Structured PostScript are the PostScript driver under Windows, which works for any Windows program that can print, including Word, Write and Notepad; and programs like `devps' and `dvips' under UNIX. Your printer does not need to be a PostScript printer: the free program `gs' (Ghostscript) from GNU will print PostScript files on almost any printer type. BindBook assumes that your printer cannot do two-sided printing. It normally produces two PostScript files, `psprint_1.ps' to be printed on the front sides of the pages and `psprint_2.ps' to be printed on the backsides. If your printer CAN do double-sided PostScript printing, use the -d flag described below. There is a Glossary at the end of this manual, explaining the terms used. Also read the section on limitations below. PARAMETERS BindBook can produce three types of "books": "bound" books with folded signatures, "glued" half-size books, and "folder" books in two-up format, to be stored in folders or the like (see Glossary). Which format is produced may be controlled by the first flag, which must be one of -B, -G or -F, for respectively bound, glued and folder books. In the absence of a -B, -G or -F flag, the first letter of the program name is used; it must be b, B, g, G, f or F, or an error message will result. This means for example that if you make a copy of the program `bindbook' and rename it `gluebook', you have got a new program which will produce glued books without needing a -G flag. There is another flag that can be used in this position: -C. It does not produce reduced pages but just copies the input PostScript files to output. Although this is not an operation that properly belongs in the BindBook package, it is useful for concatenating several PostScript files (using the -d flag) or for achieving (full-size) double-sided printing on a printer that does not normally support it. All flags have to be given separately; combined flags, for example -dl, do not work. The pages printed and the signature size can be influenced through the following flags: -b Produces empty pages before the text. This is useful in making bound books, in which one leaf is needed to be glued to the cover and another is needed as a fly leaf before the title page. The default is -b4 for bound books, and -b0 for glued books and folder books. -a Produces at least empty pages after the text. The default is -a4 for bound books and -a0 for glued books and folder books. The actual number may be higher, depending on how the book ends (in terms of pages, that is). -s Makes signatures of at most sheets each. The default is -s5. The actual number of sheets in a signature may be less, due to signature balancing. If you specify -s0 all the pages in the input files are collected in one signature. -p- The output will at least contain page until . Leaving out will cause printing to start at the first page, leaving out will cause printing to continue up to and including the last page. If producing a bound book, the entire signature or range of signatures which contain the requested pages will be printed; otherwise only those sheets which contain the requested pages will be printed. Examples: -p32-38 pages 32, 33, ..., 37, 38 -p-38 pages 1, 2, ..., 37, 38 -p32- pages 32, 33, ..., last page -p[,,...] Similar to the above, except that only the sheets with the given page numbers are printed, regardless of the further mode of operation. This is good for replacing damaged or smudged sheets. Examples: -p32 the sheet that contains page 32 -p32,34 the sheet or sheets with pages 32 and 34 Note: -p32-32 for a bound book: the signature with page 32 The names and contents of the output files can be influenced through the following flags: -o Normally, the names of the produced files are derived from `psprint'. The -o flag can be used to change this basic name or to produce the files in another directory. Examples: -oqwert produces the files `qwert_1' and `qwert_2' -o\tmp\x produces `\tmp\x_1.ps' and `\tmp\x_2.ps' -d Causes the output to be written to a single PostScript file, normally called `psprint.ps'. For printers that do double-sided PostScript printing. -2 Causes the output to be written to two PostScript files, normally called `psprint_1.ps' and `psprint_2.ps'. For printers that cannot do double-sided PostScript printing. The orientation of the printed pages can be influenced though the following flags: -l Causes the left hand page to be oriented upside down; this may be useful if the input consists of pages in landscape mode. For an application see the instructions for preparing half-size books. -r Causes the right hand page to be oriented upside down. The exact looks of the printed output can be influenced through the following flags: -w Metric: Specifies the paper width in millimeters, as a decimal number. The default is -w210.2 which corresponds to the width of a sheet of A4 paper. Letter: Specifies the paper width in inches, as a decimal number. The default is -w8.5 which corresponds to the width of a sheet of Standard Letter paper. -h Metric: Specifies the paper height in millimeters, as a decimal number. The default is -h297.3 which corresponds to the height of a sheet of A4 paper. Letter: Specifies the paper height in inches, as a decimal number. The default is -h11 which corresponds to the height of a sheet of Standard Letter paper. -m Specifies a magnification adjustment in percents. For example, a flag -m7.5 will increase the size of the printed text by 7.5%; a flag -m-3.75 will decrease the size of the printed text by 3.75%. The default is -m0.0. The precise positioning of the printed output can be influenced through the following flags; their effect is independent of any adjustment in the position or magnification. -g Metric: Specifies an increase of the gutter width (see Glossary) in millimeters. For example, a flag -g2.0 will make the gutter 2 millimeters wider (and move each page one millimeter off the middle). A flag -g-2.0 moves them two millimeters together. The default is -g0.0. Letter: Specifies an increase of the gutter width (see Glossary) in inches. For example, a flag -g0.2 will make the gutter 0.2 of an inch wider (and move each page 0.1 inch off the middle). A flag -g-0.2 moves them 0.2 of an inch together. The default is -g0.0. -x Moves the entire printed text to the right with respect to the paper when held in landscape orientation. The distance is in millimeters when metric and in inches when using Letter. The default is -x0. -y Moves the entire printed text upwards with respect to the paper when held in landscape orientation. The distance is in millimeters when metric and in inches when using Letter. The default is -y0. INPUT FILES The input file(s) indicated in the synopsis by `[file|-] ...' must be one or more Structured PostScript files. The filename indication `-' represents standard input and can occur in any position (but only once). The usual wild-card characters ? and * can be used in the file names, to save on typing and to keep the command line short. Also, if a file name is preceded by an @ sign, the corresponding file is expected to contain a list of parameter and/or file names rather than the PostScript code itself. Note: Due to the way the files are processed, the input and output files can be the same. A call bindbook -F -d psprint.ps will read `psprint.ps', make a folder book out of it and write it back (for what it is worth). PAPER SIZES The DOS version of this program is supplied in the form of four EXEs, two for metric (A4) paper size and two for Letter (8.5x11 inches). See the file install.txt for more details. The source code of the program is geared to the metric system: default paper size is A4 and measurements are in millimeters. Other paper sizes and units can be chosen by editing the Makefile or modifying the file `param.h' and recompiling the program. It should be pointed out that with other paper sizes, for example 8.5x11 inches, the fit of the two pages on one sheet will be less neat than it is with A4. The reason is that the proportions of a folded 8.5x11 are no longer 8.5 to 11, but rather 5.5 to 8.5, which is 7.778 to 12.021. So the folded version is much narrower and taller than the original. It may be useful to trick your word processor into thinking this is the paper format you have got, when making up the original pages. STEP-BY-STEP RECIPES For all cases: Step 0. Finish editing your text or texts and use your word processor and/or auxiliary software to produce one or more Structured PostScript files. Often the text will be one PostScript file and the front page another file; alternatively, each chapter can be a separate file. For this example we assume that there are two files, `frontpg.ps' and `text.ps'. Note that for a bound book the front page file will have to contain TWO pages, to make the first chapter start on a right hand page. For normal-size books, follow the steps below; for "half-size" books see the instructions further on. Step 1. Call bindbook, as follows: bindbook frontpg.ps text.ps to produce a bound book; or bindbook -G frontpg.ps text.ps to produce a glued book; or bindbook -F frontpg.ps text.ps to produce a folder book. Add flags as needed, as described above. This call writes two lines reporting what was produced, for example: `Bindbook' produced the files `psprint_1.ps' and `psprint_2.ps'. These files print 12 signatures, requiring 60 sheets of paper. Step 2. Print the file `psprint_1.ps' on a stack of empty paper. Reinsert the stack into the printer and print the file `psprint_2.ps' on the backsides. For most printers, you do not need to rotate the stack before reinserting it: the tops of the reduced pages should normally be near the same edge on both sides of the paper. Only when you are producing a folder book that is to be read by turning over the sheets upwards do you have to rotate the stack of sheets before reinserting it into the printer. If the printer jams on a page, you can use the -p flag to produce `psprint_1.ps' and `psprint_2.ps' files to reprint only the affected pages. Follow these steps 3 through 8 to produce a bound book: Step 3. Put the produced stack of printed pages in front of you, in landscape orientation. You should now be looking at two consecutive pages - the middle pages of the first signature. Step 4. Note the page number of the right hand page, or its contents if the pages are not numbered. Step 5. Count off sheets until the page number changes abruptly. You have now isolated the first signature. Normally it consists of five sheets, but the actual number may differ if you used the -s flag, or due to signature balancing. Step 6. Fold the sheets left over right. You now hold the first signature, in the position in which it should find its place in the bound book. Step 7. Repeat step 4 through 7 until the printed stack is exhausted. Step 8. The signatures can now be sewn or stapled and be bound into a book. Follow these steps 3 through 6 to produce a glued book: Step 3. Put the produced stack of printed pages in front of you, in landscape orientation. The left hand page on the top sheet should now be the first page of the book. Step 4. Cut the stack vertically between the two reduced pages. Step 5. Put the left hand half on top of the right hand half. Step 6. The book can now be glued together or put in a binding mechanism at the left edge. Follow these steps 3 through 4 to produce a folder book: Step 3. Put the produced stack of printed pages in front of you, in landscape orientation. The two pages on the top sheet should now be the first two pages of the book. Step 4. The book is now readable as is. STEP-BY-STEP RECIPE FOR HALF-SIZE BOOKS Step 0. Prepare the input according to step 0 above. Step 1. Call bindbook twice, as follows: bindbook -d frontpg.ps text.ps bindbook -G -r psprint.ps Step 2. Print psprint_1.ps and psprint_2.ps as in step 2 above. Step 3. Put the produced stack of printed pages in front of you, in portrait orientation. The top half of the top sheet should show the middle pages of the first signature in the book, in upright position. Step 4. Cut the stack horizontally between top and bottom half. Step 5. Turn the bottom stack around so its text will be upright and put it under the top stack. Step 6. Apply steps 4 through 8 for bound books given above, to create a half-size bound booklet. STEP-BY-STEP RECIPE FOR 4-UP SHEETS Step 0. Prepare the input according to step 0 above. Step 1. Call bindbook twice, as follows: bindbook -F -d frontpg.ps text.ps bindbook -F psprint.ps Step 2. Print psprint_1.ps and psprint_2.ps as in step 2 above, but turn over the stack of sheets in between. Step 3. The sheets are now readable as is. LIMITATIONS Delayed printing: Unfortunately, what BindBook tries to do is impossible in theory: the only correct way to position, rotate, etc., PostScript pages as independent objects is to obtain them as separate Encapsulated PostScript files. Supplying a 200 page book as 200 separate Encapsulated PostScript files, however, is awkward. The problem is that, unlike Encapsulated PostScript, normal PostScript contains commands to actually print the page on a sheet of paper. This command normally comes at the end of a page, but when more than one page is to be displayed on one sheet, this command must be delayed, or each reduced page will be printed on a separate sheet of paper. Now, there is a standard way of printing the actual sheet of paper (using the command `showpage'), but writers of PostScript are free to define their own variations, and most PostScript-generating program do so. The result is that BindBook no longer knows which command(s) to delay. As a pragmatic approach to this problem, BindBook has a built-in table of PostScript styles it knows, together with how to delay printing for each style. If BindBook does not recognise the style, it will just delay the action `showpage'. New styles can be added by editing readfls.c and recompiling. See the comments in readfls.c. The delayed printing information should probably be read from a file rather than being compiled in. I'll do this when it becomes necessary. Interference between flags: Not all conflicts between values specified in flags are detected; attempts to read standard input more than once are not detected either. Combining from different sources: It is not reasonably possible to combine PostScript files generated by different programs or mechanisms. The program will nevertheless try to do so, but it will issue warnings, and the result probably will not work. NOTE ON TROUBLESOME POSTSCRIPT VARIANTS The PostScript code generated by Windows 3.11 module PSCRIPT.DLL contains the commands 'SVDoc restore /SVDoc save def' every 54 pages or so. These commands crash both the WinType PostScript printer and GNU's ghostscript. I don't have the time or the inclination to find out what they mean. Bindbook removes them, and then all works fine. C code to patch other wayward PostScript variants can be added in the source file readfls.c. See comments there. Note that this is a different problem than the delayed printing problem described above. TERMINOLOGY page: One printed side of paper in a book: not the paper itself, just its printed side. leaf: Flap of paper in a book, usually with print on both sides: you can pick up a book by a leaf (if it's strong enough) but you can't pick up a book by a page. sheet: Piece of paper, as fed into the printer. In a bound book produced by this program, a sheet will supply two leaves and carry four pages. signature: A small stack of sheets, sewn or stapled in the middle and subsequently folded. A signature of N sheets will produce 2xN leaves holding 4xN pages. A number of signatures is combined into a book. bound book: A stack of signatures, held together at their folded edges by yarn, glue, gauze or other bookbinder techniques. glued book: A stack of leaves originating from cutting a stack of sheets in two, held together by glue (or a binder mechanism) at the left edge. folder book: A stack of sheets in landscape orientation, to be read as is. Pages are normally turned by flipping the sheets over upwards around the long top edge, but can also be turned by turning the sheets over to the left around the short left edge. signature balancing: Occasionally, the last signature of a book turns out to contain only a few pages, which is unesthetical. Signature balancing distributes the pages more evenly over the signatures, thus avoiding the problem. gutter: The space between the right edge of the left page and the left edge of the right page in a book. flag: An indication given in the call to a program, to modify its behaviour. Flags are called `switches' in DOS and then start with a slash sign (/); for this program they start with a minus sign (-). Flags are also called `options' or `parameters'. PostScript: A set of computer instructions that describe precisely how a number of printed pages should look. These instructions can be executed by a PostScript printer, to produce the described pages on paper or by a PostScript interpreter, to show them on screen. Structured PostScript: PostScript with special markers in it, which often allow relatively simple programs (like this one!) to find out where printed pages start and end. AUTHOR Dick Grune, Vrije Universiteit, Amsterdam. # This file is part of the PostScript package BindBook. # Written by Dick Grune, Vrije Universiteit, Amsterdam. # $Id: bindbook.txt,v 1.7 2001/11/15 12:02:47 dick Exp $