Problem:
This example program demonstrates how to use the Windows SDK Printing and Spooling functions to print a document which contains embedded printer ESC sequence codes. These codes can control various formatting features of the printer.
Resolution:
INTRODUCTION
==========
This example program demonstrates how to use the Windows SDK Printing and Spooling functions to print a document which contains embedded printer ESC sequence codes. These codes can
control various formatting features of the printer.
This example demonstrates how this can be accomplished by setting up the printer as a Raw device so as to bypass the print driver and write directly to the printer itself.
Printer ESC codes differ between different manufacturers and models so this method is definately not portable. This program was written for an HP LaserJet 5L printer and uses the ESC
codes supported by this model and other HP LaserJet printers.
You can modify this program for your own testing by changing the value in the printer-name parameter and printer-esc-codes to the appropriate values for your supported printer.
SOURCE FILES:
=========
Program Files Description
-------------------- -----------------------------------------------------------
PRINTRAW.CBL Program that calls the WINAPI functions to send data to the printer in Raw
mode.
WINSPOOL.LIB Import library from the Windows SDK. This file is linked into PRINTRAW.EXE
to resolve the references to the various printer functions. This is provided
with the Windows SDK. See Requirements.
REQUIREMENTS:
==========
This sample is setup to run with an HP LaserJet 5L printer although it should work correctly with other HP LaserJet models. If you do not have an HP LaserJet printer attached, then the program needs to be modified for your specific printer. Place the name of your printer in the printer-name variable and replace the printer-esc-code values with the ones supported by your printer.
In order to link this program you need to install the Microsoft Windows 32-bit SDK. This CD-ROM is supplied with Net Express. The installation should create a directory MSTOOLS\\LIB directory.
Modify the Build Settings for PRINTRAW.EXE under Link/Advanced and change the location of WINSPOOL.LIB to point to the directory containing this file on your system.
OPERATION:
========
Rebuild this project to create the file printraw.exe. This is a character mode program that will display its progress to an application output window.
NOTE:
====
The file WINSPOOL.LIB is specified under Project/Build Settings/Link/Advanced in the Link with these LIB's field. It must be included in any program that makes a call to these printer functions.
==========================================================
Keywords: demonstration, sample, example, demo, mainframeprint.zip
demo.ex
demo.me
demo.ne