From ad6da4a71f2b837a791401e658a16bf6903fd3b5 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 5 Jan 2018 15:40:09 +0000 Subject: split out page handling into new module --- test/parsepdf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/parsepdf.c b/test/parsepdf.c index 1d7a086..ad6c6c4 100644 --- a/test/parsepdf.c +++ b/test/parsepdf.c @@ -18,6 +18,7 @@ #include #include +#include static nspdferror read_whole_pdf(const char *fname, uint8_t **buffer, uint64_t *buffer_length) @@ -62,6 +63,7 @@ int main(int argc, char **argv) struct nspdf_doc *doc; nspdferror res; struct lwc_string_s *title; + unsigned int page_count; if (argc < 2) { fprintf(stderr, "Usage %s \n", argv[0]); @@ -91,6 +93,14 @@ int main(int argc, char **argv) printf("Title:%s\n", lwc_string_data(title)); } + res = nspdf_count_pages(doc, &page_count); + if (res != NSPDFERROR_OK) { + printf("page count failed (%d)\n", res); + return res; + } + printf("Pages:%d\n", page_count); + + res = nspdf_document_destroy(doc); if (res != NSPDFERROR_OK) { printf("failed to destroy document (%d)\n", res); -- cgit v1.2.3