pdfio/test_mod.c

35 lines
732 B
C
Raw Normal View History

2024-02-09 16:00:18 +01:00
#include <stdio.h>
#include <stdlib.h>
#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);
2024-02-09 16:00:18 +01:00
printf("Number of keys in this page: %d\n", num_keys);
const char *key;
2024-02-09 16:00:18 +01:00
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);
2024-02-09 16:00:18 +01:00
}
pdfioFileClose(pdf);
return 0;
}