LJVGA: A VGA to HP Laserjet Print Screen Utility Version 1.61 Copyright (c) 1992 Ares Technologies. All Rights Reserved. VGA is a trademark of International Business Machines Corporation. Hewlett-Packard and HP are registered trademarks of Hewlett- Packard Corporation. LJVGA: A VGA to HP Laserjet Print Screen Utility LJVGA is Terminate-and-Stay-Resident (TSR) program that allows you to print any VGA or Super VGA screen to an HP Laserjet or compatible printer. With a memory overhead of only 8.5k, you can print anything you can display on your VGA card - graphics, text, even hi-res text and 256-color screens! LJVGA is simple to use. Just run the command LJVGA, and you're ready to print anything! Hitting the Print Screen key (PrtSc) will activate LJVGA, causing it to print your current screen to the printer. Text screens print just like they look, with lines and other special characters you don't usually get. Graphics screens are automatically scaled to the resolution and page you choose. NEW AND IMPROVED! If you have previously used LJVGA, you will find a number of useful enhancements in this version. Perhaps the most popular of these is the new orientation option, which now allows you to print your graphics screens in landscape mode! Also new are a selection of dither algorithms and contrast and brightness controls. With these new controls you have much more control over the appearance of your printed output. The dither algorithms in this version have changed somewhat. Previous versions of LJVGA used one dither - the Floyd-Steinberg algorithm. Version 1.61 adds new variations of the Bayer algorithm. These two dithers are 30% faster than the Floyd- Steinberg algorithm, but produce a poorer image. The older Floyd- Steinberg method is still available, but is no longer the default. If you notice a difference in your output with this version, it is because you are now using the Bayer algorithms. See the section on Using LJVGA for instructions on choosing the selecting the appropriate algorithm. USING LJVGA Using LJVGA is simple. Running the command LJVGA will load LJVGA as a TSR. LJVGA will load with its default options, allowing you to print most any text or graphics screen by simply hitting the Print Screen key. You can modify the default options by using a combination of command-line switches, either the first time you run LJVGA, or later to modify the options already loaded in memory. LJVGA cannot be loaded twice. If you have already loaded LJVGA, it will update the copy in memory when you run it again. LJVGA supports several different command-line switches. These can be entered alone or as a group to change the default behavior of LJVGA. Be aware that when you use LJVGA to update a TSR already in memory, all options are reset to their defaults. Therefore, you must be careful to use all appropriate options each time you run LJVGA. LJVGA can also read its options from the DOS environment. When it is run, LJVGA will look for the environment variable "LJVGA". If "LJVGA" is set, LJVGA will read the value as if it were entered on the command-line. The environment is read first, so settings entered on the command-line will override any settings entered in the environment. See the examples below for more information. The possible options are listed below. -? Print synopsis. This option prints a copyright notice and a short summary of options. No other action is taken if you use this option. -d Disable LJVGA. This option will cause LJVGA to return control to the previously loaded print-screen routines (usually in the system BIOS). This option does not remove LJVGA from memory. -e Enable LJVGA. This option will enable LJVGA if it has been previously disabled. LJVGA will regain control with the settings it had when it was disabled. -u Unload LJVGA. This option will disable LJVGA and remove it from memory. LJVGA will only unload if it is the last TSR loaded. -n Instant print. This option will cause LJVGA to immediately print the current screen without becoming resident. This option can be used to run LJVGA from batch files, and could be used to create a primitive file printing program. This option will cause LJVGA to ignore any previously loaded copy, and will use only default options and options set on the command-line. -lN Set printer port. This option allows you to change the printer port LJVGA will print to. Possible values for N are 1 for LPT1, 2 for LPT2, or 3 for LPT3. You can also set N to 0 to print to PRN:. Note: Setting the printer port to 0 will also force LJVGA into DOS print mode (explained below). -pN Set print mode. This option allows you to change the method by which LJVGA sends data to the printer. This is useful in cases where you are using certain print redirectors or when you have a defective BIOS. Possible values for N are listed below. 0 - BIOS print mode. All printing is done through calls to the system BIOS. This is the default option and is the fastest print mode. This option should be chosen except in special situations. 1 - BIOS print mode with DOS Signalling. This print mode is intended for use with some network software. When using this mode, LJVGA prints all data through the system BIOS, but also uses DOS to open and close a phantom print file. This method can be used on certain networks to signal the beginning and ending of a print job. 2 - DOS print mode. When using this print mode, LJVGA prints all data through DOS calls. This option is included for situations in which compatibility is a problem, or where output should be redirected to special DOS devices. -rN Set resolution. This option allows you to set your printer's graphics resolution in dots-per-inch (DPI). Possible values for N are 75, 100, 150, and 300. The default is 300 DPI. LJVGA will automatically scale graphics to the resolution you choose. -ox Set page orientation. This option allows you to select portrait (upright) or landscape (sideways) graphics. Set x to "p" for portrait or "l" for landscape. The default is portrait graphics. -f Suppress form-feed. Normally, LJVGA will eject the page from the printer once it has finished the screen. This option will cause LJVGA to leave the page in the printer until it is full. NOTE: You may run out of memory while printing high-res graphics with this switch. Make sure your printer has enough memory for the whole page! Also, LJVGA normally resets the printer options to produce the cleanest print possible. It cannot do this while using the -f option. If you experience problems printing with the -f option, manually reset your printer before printing. -i Invert colors. This option will invert the colors for graphics screens so that white on the screen will print as black and vice-versa. Other colors are similarly reversed, printing a "negative" of the screen image. -aN Select dither algorithm. This option allows you to select the method LJVGA uses for creating the output image. The "dither" is the method by which LJVGA determines the pattern of dots to print on the output to simulate different colors. The different algorithms produce different results and are useful for different types of applications. Experiment with these options to see which works best for you. Possible values for N are listed below. 0 - Bayer-Dispersed algorithm. This is the fastest dither method and is the default. This is a good general-purpose algorithm and is characterized by cross-hatch patterns in the output. 1 - Bayer-Clustered algorithm. This is a modification of the Bayer-Dispersed algorithm and is commonly referred to as "halftoning." This method produces a pattern of different size dots producing an image similar to the pictures in a newspaper. 2 - Bayer Semi-Clustered. This is a variation of the Bayer-Clustered algorithm that produces four smaller dot rather than one large dot. Results are comparable to the Bayer-Clustered algorithm, but the resulting image is more pleasing due to the smaller dot size. 3 - Bayer Semi-Clustered Vertical algorithm. This is a modification of the Bayer algorithms which produces vertical line patterns in the image. This produces a very pleasing, consistent image, but results in very poor contrast. 4 - Floyd-Steinberg algorithm. This dither method is slower than the Bayer algorithms, but produces much better output for continuous-tone images. This is the same algorithm used in the original versions of LJVGA. -cN Set contrast. This option allows you to change the contrast of the printed output. Areas of similar color can be blended or accentuated using this option. Possible values for N range from -32 to 1024. Negative values decrease the contrast, with -32 corresponding to 50% grey output. Positive values increase the contrast, with 1024 corresponding to an image with only pure black and white. 0 is the default and results in no adjustment. -bN Set brightness. This option allows you to change the brightness of the printed output. The output can be made "blacker" or "whiter" with this option. Possible values for N range from -64 to 64. Negative values increase the black level, with -64 corresponding to a completely black image. Positive values increase the white level, with 64 corresponding to a completely white image. 0 is the default and results in no adjustment. Note: At 300 DPI on most laser printers, the black dots tend to overwhelm the white space, resulting in fairly dark images. This can be compensated by increasing the brightness. Good results have been achieved print GIF images with a brightness of approximately 16. -sN,N Set scaling. This option allows you to control the size of the printed image. LJVGA will normally print the largest image that will fit on the page at the given orientation and resolution, but you can scale the size up or down with this option. This option takes a pair of numbers representing the x- and y-scaling respectively. Each number represents the number of printed pixels that will be used to represent each screen pixel in the respective direction. For example, LJVGA normally uses the values 3,3 when printing a 640x480 screen at 300 DPI in portrait orientation. This means that for each pixel on the screen, LJVGA will print a box 3 pixels wide by 3 pixels long. These values come from the following computation. Most laser printers can print approximately 2450 pixels across at 300 DPI. We want to represent 640 screen pixels across, so 2450 / 640 = 3.83. Since LJVGA cannot print fractional pixels, it will print 3 pixels across for every screen pixel. This is the x value. The y value is computed from the x value to produce the correct aspect ratio on output. With this option, you can set the scaling for a smaller image or for a larger image. If you specify a scaling factor greater than the maximum, the output image will be clipped to the dimensions of the page. You do not have to set both values. If either number given is 0, the scaling value for that direction will be determined from the value for the other direction in order to preserve the correct aspect ratio. Setting both values to 0 will result in the default, maximum-size image. For your reference in determining the appropriate scaling values, LJVGA assumes that the output must fit on a 8.25" x 10" page. The number of output pixels that this represents varies depending on the resolution chosen. Also, note that the x and y values correspond to screen dimensions, and thus may change depending on the page orientation selected. -z Load debugging code. This option will cause LJVGA to load an additional 1k of debugging code. This option can only be specified the first time LJVGA is loaded and cannot be disabled without unloading LJVGA. Once this option is loaded, LJVGA will produce an extra page containing information about the state of your VGA card each time you press the Print Screen key. This option should be used on the advice of Ares Technologies personnel to assist in resolving printing problems. -xN Set VGA card type. This option allows owners of ATI VGA boards to use LJVGA. Because the ATI BIOS does not return certain parameters correctly, this option is necessary to print the ATI high-resolution modes. Owners of all other board types should use the default BIOS option. Possible values for N are listed below. 0 - BIOS support. This is the default for LJVGA. 1 - ATI hardware support. This option allows LJVGA to access the ATI hardware directly. EXAMPLES LJVGA : Load LJVGA into resident memory using the default options. LJVGA -l2 : Load LJVGA into resident memory and redirect output to LPT2:. LJVGA -ol -a4 : Load LJVGA into resident memory and choose landscape graphics with Floyd-Steinberg dithering. LJVGA -r75 -n : Print the current screen at 75 DPI. Do not load LJVGA into resident memory. LJVGA -s1,1 : Load LJVGA into resident memory and set the scaling so that each screen pixel is represented by one printer pixel. LJVGA -s0,4 : Load LJVGA into resident memory and set the scaling so that each screen pixel is represented by 4 printer pixels down and by an appropriate number of printer pixels across. LJVGA -d : Disable a previously loaded copy of LJVGA and return print-screen control to the system BIOS. set LJVGA=-b16 -ol LJVGA : Load LJVGA into resident memory and choose landscape graphics with brightness set to 16. set LJVGA=-ol -a4 LJVGA -a0 : Load LJVGA into resident memory and choose landscape graphics. Choose Bayer-Dispersed dithering. (The command line option -a0 overrides the environment option -a4.) HOW IT WORKS LJVGA has two primary jobs - printing text and printing graphics. Printing text is straightforward. LJVGA simply reads the text from the screen and sends it to the printer. LJVGA has an advantage over the built-in print screen routines, however, since it knows how to control the laser printer. Thus, LJVGA can set up the printer to print the extended characters such as the line- drawing characters. It can also set up the printer to handle special screen modes such as the 132x60 text modes available on some SuperVGA cards. Printing graphics is where LJVGA is most useful. DOS has only very basic graphics printing capability - and even then this ability is only made available by loading large TSRs. LJVGA solves this shortcoming by providing high-quality printing in a very small package - approximately 8.5k resident. The biggest problem faced by LJVGA is how to produce a recognizable image of the screen, which can have up to 256 colors out of a palette of 262,144 colors, on the laser printer, which has only 2 colors - black and white. LJVGA solves this problem by a method called dithering. This is a method by which a larger number of colors can be represented by using patterns of dots chosen from a smaller number of colors. In this case, that allows up to 256 colors to be represented by different patterns of only two colors. Actually, colors images cannot be accurately reproduced on a black-and-white printer (obviously!) Therefore, LJVGA actually produces a print that is based on the intensities of the colors on the screen. This is the same as saying that if you were to convert the colors on screen to shades of grey, LJVGA produces an approximation of the shades-of-grey screen. This works because the human eye is more sensitive to certain colors than to others, thus these colors can be approximated by different shades of grey. Thus, by printing areas of dots of varying densities, LJVGA can approximate these grey shades. Printing just a few dots results in bright areas, while printing more dots results in dark areas. LJVGA uses two major varieties of dithering to produce these dot- densities. The first, fastest method is known as ordered or Bayer dithering and uses a predefined pattern to reproduce each color. This pattern contains a set of numbers representing color threshold values. As the image is generated, each screen pixel is compared against the threshold value at the spot in the pattern where that pixel will be plotted. If the pixel color is greater than the threshold value, a dot is printed. Otherwise, no dot is printed. Thus the output image has a regular, ordered appearance, because it is based completely on the original pattern. LJVGA uses two different patterns for this method. The first is a "dispersed" pattern which produces dots in a widely spread pattern. Because of the way this pattern is generated, it produces a characteristic cross-hatched output. The second pattern is a "clustered" pattern. In this pattern, similar threshold values are grouped closely together to produce large dots. This pattern generates an image which appears to be made up of different sized dots, much like the pictures in a newspaper. The second variety of dithering is known as random dithering because it produces dots in a seemingly random manner. This dither is also known as an error-dispersion dither because of the way it produces dots. This method works in two steps. In the first step, the current screen pixel is compared against a predefined threshold value. If the color is greater than the threshold, a dot is printed, otherwise, no dot is printed. The second step compares what is actually printed against what should be printed. This produces an "error" value which is divided up and added to the neighboring screen pixels. This is repeated for every pixel in the image. Thus if a dot is supposed to be dark grey and we plot black, the error value generated reduces the chance that the next pixel plotted will also be black, ensuring that we get an area of "dark grey" on the output. This method is slower than the ordered dithers because of the math involved, but because it is based on the image itself, and not on a predefined pattern, it significantly reduces the chances of incidental patterns ("artifacts") emerging in the final output. There are many variations of random dithering, but LJVGA uses only one of these, the Floyd-Steinberg dither. ADDITIONAL NOTES Printing graphics on a laser printer requires large amounts of memory. If you are planning on printing graphics screens at 300 DPI, you should have at least 1 megabyte of memory in your laser printer. 512k should be sufficient for printing text and graphics at lower resolutions. LJVGA is only guaranteed to work with VGA screen modes that are supported by video BIOS. Most SuperVGA cards have extended BIOS chips which support all of the vendor-defined modes and thus will work with LJVGA. However, some graphics packages such as PICEM and VPIC can directly program VGA cards into modes not supported by BIOS. LJVGA is NOT guaranteed to work with these modes. For the future, we plan to enhance LJVGA to support VGA hardware directly. This will increase its speed and flexibility, and will allow it to print these special modes. If you discover any unsupported modes, please let us know about them and we will consider them when the enhancements are made. REPORTING BUGS If you discover what seems to be a bug in LJVGA, please let us know! If we verify a bug you discover, you will receive a free registered version of the fixed program! CURRENT KNOWN PROBLEMS Only supports video BIOS-supported modes. When using print modes 1 or 2, LJVGA cannot be invoked while a DOS function is active. This is due to an untraceable bug and will be corrected soon. LJVGA RELEASE HISTORY v0.50 (910307) Initial release. v1.00 (910326) Added resolution option. Added printer port option. Added error detection for missing or off-line printers. Added the ability to detect and update a previously loaded copy. v1.10 (910622) Added the disable/enable options. v1.20 (910730) Added suppress form-feed option. v1.30 (920304) Fixed a bug with command-line parsing under MS-DOS 4.0/5.0. Added invert option. Added unload option. v1.50 (920422) Added instant print option. Added print mode option. Added page orientation option. Added Bayer dithers. Up to 30% faster than previous dither. Added contrast option. Added brightness option. Added scaling option. Added debugging option. Fixed an error in the Floyd-Steinberg dithering option. Output is now much improved. Added better interrupt handling for improved safety and error control. Fixed a bug which would allow LJVGA to load when using the enable/disable controls. Fixed a bug which prevented LJVGA from finding a previously loaded copy in fragmented memory. Fixed text print routine so that control characters are printed, not interpreted. v1.52 (920608) Corrected color mapping for 16-color modes. Corrected control character printing. This bug was only noticable on non-HP printers. v1.53 (920627) Added use of DOS print-screen busy flag. Made resident section more crash-proof. Added serial numbering. v1.61 (920814) Added two new Bayer dithers. Modified to keep only one dither pattern in active memory. Increased support for older networks. Fixed a problem with the DOS print-logging flag in Gateway machines. Added color resolution checks for certain VGA adapters. Added ATI-specific code. TECHNICAL SUPPORT If you have any questions or comments about LJVGA, contact: Mail: Ares Technologies 243 Fairfax Rd. Blacksburg, VA 24060 Phone: 703-552-5983 E-Mail: CIS 73237,1572 Ares Technologies is also available for custom programming projects. Please feel free to contact us if you would like to discuss your programming needs. REGISTRATION If you find LJVGA useful and convenient, a registration of $10 or more would be appreciated. If you send $20 or more, you will receive a disk containing the current version of the software. You will also receive a disk with the next major version when it becomes available. For a fee of $50, you will receive a lifetime registration for LJVGA. This will entitle you to every major and minor version of LJVGA as they are released. These will be automatically sent to you free of additional charge. Site licenses are available for commercial and multiple user organizations. Please read the file REGISTER.TXT for more information. Reseller information is available for developers wishing to bundle pre-registered versions of LJVGA with their own software. Please contact Ares Technologies directly for more information. Please state the current version of the software you are using. Send check or money order to: Ares Technologies 243 Fairfax Rd. Blacksburg, VA 24060 You can also order LJVGA from the Public Software Library with your Visa, MasterCard, American Express, or Discover card at one of the following numbers. These numbers are for ordering only. For all other information concerning LJVGA, please contact Ares Technologies directly. Mail: PsL P.O. Box 35705 Houston, TX 77235-5705 Phone: 800-2424-PSL 713-524-6394 FAX: 713-524-6398 E-Mail: CIS 71355,470 SOFTWARE LICENSE LJVGA VGA/HP Laserjet Print Screen Utility Copyright (c) 1992 Ares Technologies. All Rights Reserved. Notice: By using LJVGA, you agree to be bound by the terms of this license. If you do not agree with the conditions listed herein, you may not use LJVGA. If you have any questions regarding your software license, please contact Ares Technologies at the address listed elsewhere in this document. You may use, copy, and distribute LJVGA for noncommercial purposes only, provided the following conditions are met: No fees may be charged for use or distribution. The program and accompanying documentation must be distributed in unmodified form. Reverse compilation, reverse engineering, or any other form of code decomposition is expressly prohibited. Clubs, user groups, and shareware distributors may charge a nominal fee for expenses and handling only while distributing LJVGA. Operators of electronic bulletin board systems may charge only normal membership fees, and may not require additional fees for access to LJVGA. Distributors are encouraged to register with Ares Technologies. See the file SYSOP.TXT for additional information. Site and commercial licenses are available for LJVGA. Please read the file REGISTER.TXT, or contact Ares Technologies for more information. Ares Technologies hereby disclaims all warranties relating to this software, express or implied, including without limitation any warranties of merchantability or fitness for a particular application. Ares Technologies will not be liable for any damages, direct, consequential, or otherwise, suffered due to loss of data or any other reason, even if Ares Technologies has been advised of the possibly of such damage. In no event shall Ares Technologies' liability for any such damages exceed the price paid for the license to use the software, regardless of the form of the claim. The user of this software bears all risk as to the quality and performance of the software.