summaryrefslogtreecommitdiff
path: root/test/parsepdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/parsepdf.c')
-rw-r--r--test/parsepdf.c10
1 files changed, 10 insertions, 0 deletions
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 <nspdf/document.h>
#include <nspdf/meta.h>
+#include <nspdf/page.h>
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 <filename>\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);