pdfGetPaperNameW
Get a paper size name (Unicode).
wchar_t *pdfGetPaperNameW(wchar_t *printerName, int paperIdx, wchar_t *buf, int bufSize)
This function returns the name of
the
paperIdx
th available paper size, on the
specified printer.
paperIdx
must be between 0 and n-1, where n is the
value returned by pdfGetNumPapersW
.
The paper 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: pdfGetNumPapersW
, pdfGetPaperNameW
,
pdfGetPaperIDW
, and pdfGetPaperSizeW
are just simple wrappers
around Windows functions. There is no requirement to use these
functions if you already know the paper ID that you want to use (e.g.,
from calling DeviceCapabilities
with
the DC_PAPERS
argument).
C:
wchar_t paperName[256];
int nPapers, paperID, w, h, i;
nPapers = pdfGetNumPapersW(printerName);
for (i = 0; i < nPapers; ++i) {
pdfGetPaperNameW(printerName, i, paperName, sizeof(paperName) / sizeof(wchar_t));
paperID = pdfGetPaperIDW(printerName, i);
pdfGetPaperSizeW(printerName, i, &w, &h);
printf("paper %d: id=%d name=%ls size=%.1fx%.1fmm\n",
i, paperID, paperName, 0.1 * w, 0.1 * h);
}