大网数据广告活动
打印与设备

MXDC_ESCAPE function (Mxdc.h)

· 52CE 我爱测

The MXDC_ESCAPE printer escape function enables applications to write documents to a file or to a printer in XML Paper Specification (XPS) format by means of the Microsoft XPS Document Converter (MXDC).

The MXDC_ESCAPE printer escape function enables applications to write documents to a file or to a printer in XML Paper Specification (XPS) format by means of the Microsoft XPS Document Converter (MXDC).

To perform this operation, call the ExtEscape function with the following parameters.

Syntax

int MXDC_ESCAPE(
    hdc,
    cbInput,
    lpszInData,
    cbOutput,
    lpszOutData
);

Parameters

hdc

A handle to the printer device context.

cbInput

The size, in bytes, of the data pointed to by the lpszInData parameter.

lpszInData

A pointer to a buffer containing the input data, which is always stored in one of the following structures.

<a href="mxdcescapeheader.md">MxdcEscapeHeader</a> <a href="mxdcprintticketescape.md">MxdcPrintTicketEscape</a> <a href="mxdcs0pagepassthroughescape.md">MxdcS0PagePassthroughEscape</a> <a href="mxdcs0pageresourceescape.md">MxdcS0PageResourceEscape</a>

Each of these structures has an opcode member that specifies what the MXDC is supposed to do. See MxdcEscapeHeader for detailed remarks about these codes.

Operations code (opcode) Action
MXDCOP_GET_FILENAME Sets the lpszOutData parameter of the ExtEscape function to, either the full path of the output file as a zero-terminated string or else the size of that string.
MXDCOP_PRINTTICKET_FIXED_DOC_SEQ Associates a print ticket with an XPS fixed document sequence.
MXDCOP_PRINTTICKET_FIXED_DOC Associates a print ticket with an XPS document.
MXDCOP_PRINTTICKET_FIXED_PAGE Associates a print ticket with an XPS page.
MXDCOP_SET_S0PAGE Sends the XPS markup of the current page to the output.
MXDCOP_SET_S0PAGE_RESOURCE Sends a resource on the page, such as an image or font, to the output.
MXDCOP_SET_XPSPASSTHRU_MODE Puts the MXDC into a pass through state, enabling an application to write XPS directly to the output file without any processing by the MXDC. An entire document or even document sequence can be written in this way.

cbOutput

The size, in bytes, of the data pointed to by the lpszOutData parameter.

lpszOutData

A pointer to a buffer containing the output data.

Return value

If the function succeeds, the return value is greater than zero. If the function fails or is not supported, the return value is less than or equal to zero.

Remarks

This escape is supported by MXDC and XPSDrv, but not by GDI.

To determine if the printer driver is the MXDC, call ExtEscape with the GETTECHNOLOGY escape. If the driver is the MXDC, the ExtEscape will return the zero-terminated string, "http://schemas.microsoft.com/xps/2005/06". Be sure the buffer referenced by the lpszOutData parameter is large enough to hold this string.

To determine if the printer driver is the Windows in-box Microsoft XPS Document Writer driver, confirm that the printer driver is the MXDC, and then determine whether the name of the printer driver is "Microsoft XPS Document Writer".

To get the printer driver name, use one of the following techniques. Call GetPrinterDriver with the Level parameter value set to 1. The printer driver name is returned in the pName member of the DRIVER_INFO_1 structure.
or
Call GetPrinter with the Level parameter value set to 2. The printer driver name is returned in the pDriverName member of the PRINTER_INFO_2 structure.

The following table shows where to find various objects in the XPS file various types of objects will be written.

Object Location in the output file
Fixed Page /Documents/1/Pages/Esc%d.fpage
Thumbnail /Documents/1/Metadata
Print Ticket /Documents/1/Metadata
Font /Documents/1/Resources/Fonts
Image /Documents/1/Resources/Images

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header Mxdc.h

See also

Printing

Printer Escape Functions

ExtEscape

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。