GdiPlayPageEMF function

The GdiPlayPageEMF function plays the EMF records within a specified rectangle for one document page of a spooled print job.


BOOL GdiPlayPageEMF(
  HANDLE SpoolFileHandle,
  HANDLE hemf,
  RECT   *prectDocument,
  RECT   *prectBorder,
  RECT   *prectClip



Caller-supplied spool file handle, obtained by a previous call to GdiGetSpoolFileHandle.


Caller-supplied page handle, obtained by calling GdiGetPageHandle, identifying the page for which records are to be played.


Caller-supplied pointer to a RECT structure specifying the rectangle into which the page is to be drawn.


Caller-supplied pointer to a RECT structure specifying the page's border rectangle (if any). Can be NULL.


Caller-supplied pointer to a RECT structure specifying the coordinates of the page's clip region (if any). Can be NULL.

Return value

If the operation succeeds, the function returns TRUE. Otherwise the function returns FALSE, and an error code can be obtained by calling GetLastError.


The GdiPlayPageEMF function is exported by gdi32.dll for use within a print processor's PrintDocumentOnPrintProcessor function.

The GdiPlayPageEMF function is the means by which a print processor positions a document page or a specified rectangular region of a document page on a physical page. Note that GdiPlayPageEMF does not actually print on the device context, but instead prepares a data structure that describes the text and graphics that are to be printed on the physical page(s). The text and graphics are printed to the device context when GdiEndPageEMF is called.

The print processor uses prectClip to describe the rectangular region to be printed, and prectDocument to describe a rectangle into which the document page (or clipped region) must fit. If prectClip is NULL, the entire document page will be printed. For non-NULL values of prectClip, only the portion of the document page within the clip region will be printed. The GdiPlayPageEMF function then performs the scaling and translation operations required to make the document page (or selected portion) fit into the rectangle.

The prectBorder parameter, if it is non-NULL, describes a solid-line border rectangle to be drawn around the document page. If prectBorder is NULL, no such border will be drawn.

For additional information, see Using GDI Functions in Print Processors.


Target Platform Universal
Header winppi.h (include Winppi.h)
Library Gdi32.Lib
DLL Gdi32.dll

See also