IPrintOemUIMXDC::AdjustImageCompression method

The IPrintOemUIMXDC::AdjustImageCompression method allows an XPS filter pipeline driver to use UnidrvUI.dll or PS5UI.dll to support configuration of compression level for JPEG or PNG images.


HRESULT AdjustImageCompression(
  HANDLE         hPrinter,
  DWORD          cbDevMode,
  const PDEVMODE pDevMode,
  DWORD          cbOEMDM,
  const PVOID    pOEMDM,
  PLONG          pCompressionMode



A handle to the printer that is currently being queried.


The size of the DEVMODE structure, including appended data.


A pointer to the DEVMODE structure that contains the current device settings.


The number of bytes in the vendor-provided section of the DEVMODE structure.


A pointer to the data that is contained in the vendor portion of the DEVMODE structure that pDevMode points to.


A pointer to the current compression level. pCompressionMode is an enum type specified in Mxdc.h.

Return Value

AdjustImageCompression returns S_OK if the method succeeds. Otherwise, this method should return E_NOTIMPL if the plug-in does not support the method, or any appropriate failure value if the plug-in cannot complete the operation. For more information, see the following Remarks section.


The IPrintOemUIMXDC::AdjustImageCompression method affects JPEG and PNG images that are generated by Microsoft XPS Document Converter (MXDC). The IPrintOemUIMXDC::AdjustImageCompression method does not affect the JPEG and PNG images that are sent directly by applications to GDI via the GDI JPEG/PNG image pass-through mechanism (BMF_JPEG, BMF_PNG).

The core drivers, UnidrvUI.dll and PS5UI.dll, do not modify the image compression settings. The plug-in, however, can change the value that is initially provided to the MXDC by the GDI print path.

The pCompressionMode parameter has one of the following predefined values.

ENUM Type Value Meaning
MXDC_IMAGETYPE_JPEGHIGH_COMPRESSION 1 Lowest quality and smallest file size
MXDC_IMAGETYPE_JPEGMEDIUM_COMPRESSION 2 Medium quality and medium file size
MXDC_IMAGETYPE_JPEGLOW_COMPRESSION 3 High quality and large file size
MXDC_IMAGETYPE_PNG 4 Highest quality and largest file size

The pCompressionMode parameter is IN OUT. All other parameters for this function are input only.

If the plug-in cannot complete the operation, it should return an appropriate failure HRESULT, which causes the current print job to fail.


Minimum supported client Available with Windows Vista and later versions of Unidrvui.dll and Ps5ui.dll, which are redistributable. This method is also available for XPSDrv drivers in Microsoft Windows XP if you have installed the XPS Essentials Pack.
Target Platform Desktop
Header prcomoem.h (include Prcomoem.h)