Specifying Paper Orientation
Important
The modern print platform is Windows' preferred means of communicating with printers. We recommend that you use Microsoft's IPP inbox class driver, along with Print Support Apps (PSA), to customize the print experience in Windows 10 and 11 for printer device development.
For more information, see Modern print platform and the Print support app design guide.
There are three standard options associated with the Orientation standard feature: PORTRAIT, LANDSCAPE_CC90, and LANDSCAPE_CC270. Unless otherwise specified, the default orientation is PORTRAIT. The use of this option is straightforward, and is not discussed further in this topic. The balance of this topic is concerned with the two landscape options.
LANDSCAPE_CC90 and LANDSCAPE_CC270
The LANDSCAPE_CC90 and LANDSCAPE_CC270 options of the Orientation feature indicate the amount of rotation to be applied to text and graphics in portrait mode, to convert them to landscape mode. The LANDSCAPE_CC90 option rotates text and graphics 90 degrees counterclockwise. The LANDSCAPE_CC270 option rotates text and graphics 270 degrees counterclockwise, which is equivalent to a rotation by 90 degrees clockwise. For both options, Unidrv handles the tasks of rotating the text and graphics the indicated amount, and moving them as appropriate for the new orientation.
Many printers support both portrait mode and landscape mode, while the remaining printers, typically those with fewer features, support only portrait mode. Each mode has its own coordinate system: in portrait mode, the origin is at the upper left corner (x increases to the right and y increases downward); in landscape mode, the origin is at the lower left corner (x increases upward and y increases to the right).
Printers that do not support landscape mode can still be made to print documents in this orientation. For this type of printer, you must specify the LANDSCAPE_CC270 option in the printer's GPD file. (If you specify the LANDSCAPE_CC90 option for these printers, text and graphics will appear garbled when printed.) Under this option, Unidrv presents the transformed text and graphics to the printer with coordinates relative to the printer's upper-left-corner origin.
For a printer that supports landscape mode as well as portrait mode, you should specify the LANDSCAPE_CC90 option in the GPD file. Under this option, Unidrv must be directed to issue a landscape command string to the printer, causing it to switch from the portrait mode coordinate system to the landscape mode coordinate system (with the origin at the lower left corner). Unidrv then presents the transformed text and graphics to the printer with coordinates relative to the printer's lower-left-corner origin.
However, a printer that supports landscape mode (for which the LANDSCAPE_CC90 option ordinarily would be used), can still operate with the LANDSCAPE_CC270 option. Under this option, Unidrv is directed to treat the printer as if it supported only portrait mode (that is, with only a single coordinate system, with the origin at the upper left corner). Consequently, Unidrv must not be directed to issue a command to change coordinate systems. Unidrv presents the transformed text and graphics to the printer with coordinates relative to this upper-left-corner origin. Because Unidrv assumes this location of the origin, such a printer must not be issued a landscape mode command string, even when the user has selected the Landscape orientation on the printer's property page. In the following GPD file example, notice that the *Option: LANDSCAPE_CC270 section contains a command to place the printer into portrait mode (ORIENT_PORTRAIT_CMD), and not one to place it into landscape mode.
*Feature: Orientation
{
*rcNameID: =ORIENTATION_DISPLAY
*DefaultOption: PORTRAIT
*Option: PORTRAIT
{
*rcNameID: =PORTRAIT_DISPLAY
*Command: CmdSelect
{
*Order: DOC_SETUP.60
*Cmd: =ORIENT_PORTRAIT_CMD
}
}
*Option: LANDSCAPE_CC270
{
*rcNameID: =LANDSCAPE_DISPLAY
*Command: CmdSelect
{
*Order: DOC_SETUP.60
*Cmd: =ORIENT_PORTRAIT_CMD
}
}
}
For Windows 7, the MxdcGetPDEVAdjustment function has new parameters for landscape rotation. For more information, see MxdcXDCGetPDEVAdjustment.