gfxsource now has a getinfo function
authorkramm <kramm>
Wed, 9 May 2007 12:08:08 +0000 (12:08 +0000)
committerkramm <kramm>
Wed, 9 May 2007 12:08:08 +0000 (12:08 +0000)
lib/python/gfx.c

index 4a4c506..7e5c400 100644 (file)
@@ -312,11 +312,13 @@ static int page_print(PyObject * _self, FILE *fi, int flags)
 //---------------------------------------------------------------------
 
 staticforward PyObject* doc_getPage(PyObject* parent, PyObject* args, PyObject* kwargs);
+staticforward PyObject* doc_getInfo(PyObject* parent, PyObject* args, PyObject* kwargs);
 
 static PyMethodDef doc_methods[] =
 {
     /* PDF functions */
     {"getPage", (PyCFunction)doc_getPage, METH_KEYWORDS, ""},
+    {"getInfo", (PyCFunction)doc_getInfo, METH_KEYWORDS, ""},
     {0,0,0,0}
 };
 
@@ -341,6 +343,19 @@ static PyObject* doc_getPage(PyObject* _self, PyObject* args, PyObject* kwargs)
     return (PyObject*)page;
 }
 
+static PyObject* doc_getInfo(PyObject* _self, PyObject* args, PyObject* kwargs)
+{
+    DocObject* self = (DocObject*)_self;
+
+    static char *kwlist[] = {"key", NULL};
+    char*key = 0;
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &key))
+       return NULL;
+
+    char*s = self->doc->getinfo(self->doc, key);
+    return PyString_FromString(s);
+}
+
 static PyObject* f_open(PyObject* parent, PyObject* args, PyObject* kwargs)
 {
     static char *kwlist[] = {"type", "filename", NULL};