From 042eafdfeac139b966275672972385f6469e2dff Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 9 May 2007 12:08:08 +0000 Subject: [PATCH] gfxsource now has a getinfo function --- lib/python/gfx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/python/gfx.c b/lib/python/gfx.c index 4a4c506..7e5c400 100644 --- a/lib/python/gfx.c +++ b/lib/python/gfx.c @@ -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}; -- 1.7.10.4