Commit 62dfc589 authored by Albert Astals Cid's avatar Albert Astals Cid

* glib/test-poppler-glib.c:

        * glib/poppler-page.cc:
        * glib/poppler-page.h:
        * poppler/Page.cc:
        * poppler/Page.h: Implement /Dur entry in page object. Patch by Carlos
        Garcia Campos <carlosgc@gnome.org>
parent 34e5aa62
2006-12-26 Albert Astals Cid <aacid@kde.org>
* glib/test-poppler-glib.c:
* glib/poppler-page.cc:
* glib/poppler-page.h:
* poppler/Page.cc:
* poppler/Page.h: Implement /Dur entry in page object. Patch by Carlos
Garcia Campos <carlosgc@gnome.org>
2006-12-23 Albert Astals Cid <aacid@kde.org>
* poppler/PSTokenizer.cc: Enhance PSTokenizer::getToken performance.
......
......@@ -125,6 +125,22 @@ poppler_page_get_index (PopplerPage *page)
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 {
......
......@@ -57,6 +57,7 @@ void poppler_page_get_size (PopplerPage *page,
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,
......
......@@ -121,6 +121,7 @@ int main (int argc, char *argv[])
double width, height;
GList *list, *l;
char *text;
double duration;
PopplerRectangle area;
if (argc != 3)
......@@ -147,6 +148,12 @@ int main (int argc, char *argv[])
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);
......
......@@ -189,9 +189,12 @@ GBool PageAttrs::readBox(Dict *dict, char *key, PDFRectangle *box) {
//------------------------------------------------------------------------
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 @@ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA) {
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())) {
......
......@@ -151,6 +151,11 @@ public:
// 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 @@ private:
Object thumb; // page thumbnail
Object trans; // page transition
Object actions; // page addiction actions
double duration; // page duration
GBool ok; // true if page is valid
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment