pdfGetMediaTypeIDW

Get a media type ID (Unicode).
unsigned int pdfGetMediaTypeIDW(wchar_t *printerName, int mediaTypeIdx)
This function returns the ID for the mediaTypeIdxth available media type, on the specified printer.

mediaTypeIdx must be between 0 and n-1, where n is the value returned by pdfGetNumMediaTypesW.

The returned value can be passed to pdfPrintSetMediaType.

Note: pdfGetNumMediaTypesW, pdfGetMediaTypeNameW, and pdfGetMediaTypeIDW are just simple wrappers around Windows functions. There is no requirement to use these functions if you already know the media type ID that you want to use (e.g., from calling DeviceCapabilities with the DC_MEDIATYPES argument).

C:
wchar_t mediaTypeName[256]; int nMediaTypes, mediaTypeID, i; nMediaTypes = pdfGetNumMediaTypesW(printerName); for (i = 0; i < nMediaTypes; ++i) { pdfGetMediaTypeNameW(printerName, i, mediaTypeName, sizeof(mediaTypeName) / sizeof(wchar_t)); mediaTypeID = pdfGetMediaTypeIDW(printerName, i); printf("media type %d: id=%d name=%ls\n", i, mediaTypeID, mediaTypeName); }
pdfGetNumMediaTypesW
pdfGetMediaTypeNameW
pdfGetMediaTypeID