HOWTO: Use PASSTHROUGH Escape to Send Data Directly to PrinterLast reviewed: October 16, 1997Article ID: Q96795 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Visual Basic programming system for Windows, version 1.0
SUMMARY
By using the Windows API Escape() function, your application can pass data directly to the printer. If the printer driver supports the PASSTHROUGH printer escape, you can use the Escape() function and the PASSTHROUGH printer escape to send native printer language codes to the printer driver. Printer escapes such as PASSTHROUGH allow applications to access certain facilities of output devices that are not directly available through the graphics device interface (GDI). The PASSTHROUGH printer escape allows the application to send data directly to the printer, bypassing the standard print-driver code.
MORE INFORMATIONA printer driver that supports the PASSTHROUGH printer escape does not add native printer language codes to the data stream sent to the printer, so you can send data directly to the printer. However, Microsoft recommends that applications not perform functions that consume printer memory, such as downloading a font or a macro. The sample program listed below sends native PCL codes to the printer to change the page orientation and the paper bin. A Hewlett-Packard LaserJet is the assumed default printer. NOTE: This is not a recommended solution. For a better solution for 32-bit, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q138594 TITLE : HOWTO: Send Raw Data to a Printer by Using the Win32 API An Important NoteThe Windows API Escape() function is provided in Windows versions 3.0 and 3.1 for backward compatibility with earlier versions of Microsoft Windows. Applications are supposed to use the GDI DeviceCapabilities() and ExtDeviceMode() functions instead of the Escape() function, but neither DeviceCapabilities() nor ExtDeviceMode() can be called directly from Visual Basic. This is because they are exported by the printer driver, not by the Windows GDI. The only way to use ExtDeviceMode() or DeviceCapabilities() in Visual Basic is to create a DLL and call them from there. There have been reports of problems using the PASSTHROUGH escape with the driver HPPCL5A.DRV. This is the version of the printer driver for the HP LaserJet III series that shipped with Windows 3.1. A more recent version of the driver (HPPCL5MS.DRV), which has no known problems with the PASSTHROUGH escape, is available in the Windows Driver Library (WDL). To obtain the latest driver for the HP LaserJet III series, download the self-extracting file HPPCL5.EXE from the WDL.
Steps to Create Example
Keywords : APrgPrint kbprint kbfasttip Version : WINDOWS:1.0 2.0 3.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |