Get a media type ID.
unsigned int pdfGetMediaTypeID(char *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 pdfGetNumMediaTypes.

The returned value can be passed to pdfPrintSetMediaType.

Note: pdfGetNumMediaTypes, pdfGetMediaTypeName, and pdfGetMediaTypeID 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).

char mediaTypeName[256]; int nMediaTypes, mediaTypeID, i; nMediaTypes = pdfGetNumMediaTypes(printerName); for (i = 0; i < nMediaTypes; ++i) { pdfGetMediaTypeName(printerName, i, mediaTypeName, sizeof(mediaTypeName)); mediaTypeID = pdfGetMediaTypeID(printerName, i); printf("media type %d: id=%d name=%s\n", i, mediaTypeID, mediaTypeName); }