Index: glib/test-poppler-glib.c =================================================================== RCS file: /cvs/poppler/poppler/glib/test-poppler-glib.c,v retrieving revision 1.18 diff -u -u -r1.18 test-poppler-glib.c --- glib/test-poppler-glib.c 28 Feb 2006 18:25:00 -0000 1.18 +++ glib/test-poppler-glib.c 26 Dec 2006 16:50:18 -0000 @@ -121,6 +121,7 @@ double width, height; GList *list, *l; char *text; + double duration; PopplerRectangle area; if (argc != 3) @@ -147,6 +148,12 @@ poppler_page_get_size (page, &width, &height); printf ("\tpage size:\t%f inches by %f inches\n", width / 72, height / 72); + duration = poppler_page_get_duration (page); + if (duration > 0) + printf ("\tpage duration:\t%f second(s)\n", duration); + else + printf ("\tpage duration:\tno duration for page\n"); + thumb = poppler_page_get_thumbnail (page); if (thumb != NULL) { gdk_pixbuf_save (thumb, "thumb.png", "png", &error, NULL); Index: glib/poppler-page.cc =================================================================== RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v retrieving revision 1.51 diff -u -u -r1.51 poppler-page.cc --- glib/poppler-page.cc 21 Sep 2006 22:40:53 -0000 1.51 +++ glib/poppler-page.cc 26 Dec 2006 16:50:19 -0000 @@ -125,6 +125,22 @@ return page->index; } +/** + * poppler_page_get_duration: + * @page: a #PopplerPage + * + * Returns the duration of @page + * + * Return value: duration in seconds of @page or -1. + **/ +double +poppler_page_get_duration (PopplerPage *page) +{ + g_return_val_if_fail (POPPLER_IS_PAGE (page), -1); + + return page->page->getDuration (); +} + #if defined (HAVE_CAIRO) typedef struct { Index: glib/poppler-page.h =================================================================== RCS file: /cvs/poppler/poppler/glib/poppler-page.h,v retrieving revision 1.21 diff -u -u -r1.21 poppler-page.h --- glib/poppler-page.h 12 Apr 2006 02:07:07 -0000 1.21 +++ glib/poppler-page.h 26 Dec 2006 16:50:19 -0000 @@ -57,6 +57,7 @@ double *width, double *height); int poppler_page_get_index (PopplerPage *page); +double poppler_page_get_duration (PopplerPage *page); GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page); gboolean poppler_page_get_thumbnail_size (PopplerPage *page, int *width, Index: poppler/Page.cc =================================================================== RCS file: /cvs/poppler/poppler/poppler/Page.cc,v retrieving revision 1.14 diff -u -u -r1.14 Page.cc --- poppler/Page.cc 22 Dec 2006 23:39:41 -0000 1.14 +++ poppler/Page.cc 26 Dec 2006 16:50:19 -0000 @@ -189,9 +189,12 @@ //------------------------------------------------------------------------ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA) { + Object tmp; + ok = gTrue; xref = xrefA; num = numA; + duration = -1; // get attributes attrs = attrsA; @@ -204,6 +207,16 @@ trans.free(); } + // duration + pageDict->lookupNF("Dur", &tmp); + if (!(tmp.isNum() || tmp.isNull())) { + error(-1, "Page duration object (page %d) is wrong type (%s)", + num, tmp.getTypeName()); + } else if (tmp.isNum()) { + duration = tmp.getNum(); + } + tmp.free(); + // annotations pageDict->lookupNF("Annots", &annots); if (!(annots.isRef() || annots.isArray() || annots.isNull())) { Index: poppler/Page.h =================================================================== RCS file: /cvs/poppler/poppler/poppler/Page.h,v retrieving revision 1.6 diff -u -u -r1.6 Page.h --- poppler/Page.h 8 Oct 2006 20:38:47 -0000 1.6 +++ poppler/Page.h 26 Dec 2006 16:50:19 -0000 @@ -151,6 +151,11 @@ // Get transition. Object *getTrans(Object *obj) { return trans.fetch(xref, obj); } + // Get duration, the maximum length of time, in seconds, + // that the page is displayed before the presentation automatically + // advances to the next page + double getDuration() { return duration; } + // Get actions Object *getActions(Object *obj) { return actions.fetch(xref, obj); } @@ -198,6 +203,7 @@ Object thumb; // page thumbnail Object trans; // page transition Object actions; // page addiction actions + double duration; // page duration GBool ok; // true if page is valid };