#include #include #include "pdfio.h" /* * Usage: ./test_mod [file.pdf] * * Compiled as: * gcc test_mod.c -L. -lpdfio -lm -lz -o test_mod * */ int main (int argc, char **argv) { pdfio_file_t *pdf = pdfioFileOpen(argv[1], NULL, NULL, NULL, NULL); pdfio_obj_t *obj_page = pdfioFileGetPage(pdf, 0); pdfio_dict_t *dict_page = pdfioObjGetDict(obj_page); size_t num_keys = pdfioDictGetNumPairs(dict_page); printf("Number of keys in this page: %d\n", num_keys); const char *key; for (unsigned int i = 0; i < num_keys; ++i) { key = pdfioDictGetKeyByIndex(dict_page, i); pdfio_valtype_t type = pdfioDictGetType(dict_page, key); printf("\t%s (%d)\n", key, type); } pdfioFileClose(pdf); return 0; }