Return an entry from the ViewerPreferences dictionary.
char *pdfGetViewerPreference(PDFHandle pdf, const char *pref, int *length)
This function retrieves an entry, specified by pref, from the document's ViewerPreferences dictionary. The returned value is a null-terminated string, and its length is also stored in *length.

Returns NULL if the specified entry doesn't exist, or if the PDF file doesn't have a ViewerPreferences dictionary.

The caller is responsible for freeing the string after using it, by calling pdfFreeMemory.

char *s; int length; s = pdfGetViewerPreference(pdf, "Duplex", &length); if (s) { printf("duplex = %s\n", s); } else { printf("no duplex preference\n"); } pdfFreeMemory(s);