GdiGetDevmodeForPage function

The GdiGetDevmodeForPage function returns DEVMODEW structures for the specified and previous pages of a print job.


BOOL GdiGetDevmodeForPage(
  HANDLE    SpoolFileHandle,
  DWORD     dwPageNumber,



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


Caller-supplied number of the page for which DEVMODEW contents are to be returned.


Caller-supplied location to receive a pointer to a DEVMODE structure for the page specified by dwPageNumber.


Caller-supplied location to receive a pointer to a DEVMODE structure for the page previous to the one specified by dwPageNumber.

Return value

If the operation succeeds, the function returns TRUE. Otherwise it returns FALSE.


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

Before calling GdiPlayPageEMF to execute a page's EMF instructions, a print processor must call GdiGetDevmodeForPage to determine if the DEVMODE structure associated with the page to be printed is the same as that of the last page printed. If the two returned DEVMODE structures are not identical, the print processor must perform the following steps, in order, before calling GdiPlayPageEMF for the page:

  1. Call GdiEndPageEMF.
  2. Call GdiResetDCEMF, specifying the DEVMODE pointed to by pCurrDM.
  3. Call GdiStartPageEMF.
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