summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-01-05 15:40:09 +0000
committerVincent Sanders <vince@kyllikki.org>2018-01-05 15:40:09 +0000
commitad6da4a71f2b837a791401e658a16bf6903fd3b5 (patch)
tree761f5e5a80a907721ff596f7f82cec85a160edad /test
parenta65babe2fbd341f9d12a50a9530682ef1e015b58 (diff)
downloadlibnspdf-ad6da4a71f2b837a791401e658a16bf6903fd3b5.tar.gz
libnspdf-ad6da4a71f2b837a791401e658a16bf6903fd3b5.tar.bz2
split out page handling into new module
Diffstat (limited to 'test')
-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);