pdfGetMediaTypeNameW
Get a media type name (Unicode).
wchar_t *pdfGetMediaTypeNameW(wchar_t *printerName, int mediaTypeIdx, wchar_t *buf, int bufSize)
This function returns the name of the
mediaTypeIdx
th available media type, on the
specified printer.
mediaTypeIdx
must be between 0 and n-1, where n is the
value returned by pdfGetNumMediaTypesW
.
The media type name will be returned in buf
(up
to bufSize
-1 characters). Note: bufSize
is
the number of Unicode (wide) characters in buf
, not the
number of bytes.
Returns buf
on success, or NULL
on failure.
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);
}