Article ID: 80185 - View products that this article applies to.
This article was previously published under Q80185
Some printers support changing the orientation of the paper output to landscape. With the Windows API Escape() function, you can change the settings of the printer to either landscape or portrait. In addition, if you have one of the following products, you can use the Common Dialog box to allow users to set the mode inside a Visual Basic Application:
NOTE: The 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.
Normally, output for the printer is in portrait mode, where output is printed horizontally across the narrower dimension of a paper. In landscape mode, the output is printed horizontally across the longer dimension of the paper.
You can use the Escape() function to change the orientation of the printer by passing GETSETPAPERORIENT as an argument. When you initially print text to the printer, Visual Basic will use the currently selected orientation. Sending the Escape() function will not take effect until you perform a Printer.EndDoc. After you perform a Printer.EndDoc, output will print in the orientation that you have selected.
To determine if your printer supports landscape mode, do the following:
How to Check the Current Orientation of the Printer
To check the current orientation of the printer, use the following code:
' Enter the following Declare statement as one, single line:
How to Change the Printer Orientation to LandscapeThe following example below demonstrates how to change the printer orientation to landscape. Please note that your printer must support landscape mode for these commands to have any effect.
Article ID: 80185 - Last Review: December 12, 2003 - Revision: 2.0