X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpdf%2Fpdf.cc;h=4bcf9b9f017ee54f54a2312273cfc1cc07ed6851;hb=cba26480d2932910cb2593c6e128c166c109c9e9;hp=3f72d598281743c75131d58f48a58ee78910cd20;hpb=89d041306bf7d12bb40319e7f36c7e919f09f4c8;p=swftools.git diff --git a/lib/pdf/pdf.cc b/lib/pdf/pdf.cc index 3f72d59..4bcf9b9 100644 --- a/lib/pdf/pdf.cc +++ b/lib/pdf/pdf.cc @@ -137,16 +137,16 @@ void pdf_doc_destroy(gfxdocument_t*gfx) } } -void pdf_doc_set_parameter(gfxdocument_t*gfx, char*name, char*value) +void pdf_doc_set_parameter(gfxdocument_t*gfx, const char*name, const char*value) { pdf_doc_internal_t*i= (pdf_doc_internal_t*)gfx->internal; + GFXOutputDev*o = i->outputDev; if(!strcmp(name, "pagemap")) { - GFXOutputDev*o = i->outputDev; int pdfpage=0, outputpage=0; sscanf(value,"%d:%d", &pdfpage, &outputpage); o->preparePage(pdfpage, outputpage); } else { - msg(" Ignored parameter: %s=%s", name, value); + o->setParameter(name, value); } } @@ -179,7 +179,7 @@ static char*getInfoString(Dict *infoDict, char *key) GString *s1, *s2; int i; - if (infoDict->lookup(key, &obj)->isString()) { + if (infoDict && infoDict->lookup(key, &obj)->isString()) { s1 = obj.getString(); if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { @@ -211,7 +211,7 @@ static char*getInfoDate(Dict *infoDict, char *key) Object obj; char *s; - if (infoDict->lookup(key, &obj)->isString()) { + if (infoDict && infoDict->lookup(key, &obj)->isString()) { s = obj.getString()->getCString(); if (s[0] == 'D' && s[1] == ':') { s += 2; @@ -223,7 +223,7 @@ static char*getInfoDate(Dict *infoDict, char *key) return strdup(""); } -char* pdf_doc_getinfo(gfxdocument_t*doc, char*name) +char* pdf_doc_getinfo(gfxdocument_t*doc, const char*name) { pdf_doc_internal_t*i= (pdf_doc_internal_t*)doc->internal; if(!strcmp(name, "title")) return getInfoString(i->docinfo.getDict(), "Title"); @@ -250,7 +250,7 @@ char* pdf_doc_getinfo(gfxdocument_t*doc, char*name) } -void storeDeviceParameter(char*name, char*value) +static void storeDeviceParameter(const char*name, const char*value) { parameter_t*p = new parameter_t(); p->name = strdup(name); @@ -265,7 +265,7 @@ void storeDeviceParameter(char*name, char*value) } } -void pdf_set_parameter(char*name, char*value) +static void pdf_set_parameter(const char*name, const char*value) { msg(" setting parameter %s to \"%s\"", name, value); if(!strncmp(name, "fontdir", strlen("fontdir"))) { @@ -298,7 +298,7 @@ void pdf_set_parameter(char*name, char*value) } } -gfxdocument_t*pdf_open(char*filename) +static gfxdocument_t*pdf_open(const char*filename) { gfxdocument_t*pdf_doc = (gfxdocument_t*)malloc(sizeof(gfxdocument_t)); memset(pdf_doc, 0, sizeof(gfxdocument_t)); @@ -351,7 +351,7 @@ gfxdocument_t*pdf_open(char*filename) i->protect = 1; } - InfoOutputDev*io = new InfoOutputDev(); + InfoOutputDev*io = new InfoOutputDev(i->doc->getXRef()); int t; i->pages = (pdf_page_info_t*)malloc(sizeof(pdf_page_info_t)*pdf_doc->num_pages); memset(i->pages,0,sizeof(pdf_page_info_t)*pdf_doc->num_pages);