CommonOutputDev*outputDev;
pdf_page_info_t*pages;
gfxdevice_t* middev;
+ char*filename;
} pdf_doc_internal_t;
typedef struct _pdf_page_internal
free(i->pages); i->pages = 0;
i->docinfo.free();
+
+ if(i->filename) {
+ free(i->filename);i->filename=0;
+ }
if(i->info) {
delete i->info;i->info=0;
static void storeDeviceParameter(const char*name, const char*value)
{
+ parameter_t*o = device_config;
+ while(o) {
+ if(!strcmp(name, o->name)) {
+ /* overwrite old value */
+ free(o->value);
+ o->value = strdup(value);
+ return;
+ }
+ o = o->next;
+ }
parameter_t*p = new parameter_t();
p->name = strdup(name);
p->value = strdup(value);
p->next = 0;
+
if(device_config_next) {
device_config_next->next = p;
device_config_next = p;
pdf_doc->internal = i;
char*userPassword=0;
- filename = strdup(filename);
+ i->filename = strdup(filename);
char*x = 0;
if((x = strchr(filename, '|'))) {
GFXOutputDev*outputDev = new GFXOutputDev(i->info, i->doc);
i->outputDev = (CommonOutputDev*)outputDev;
}
-
/* pass global parameters to PDF driver*/
parameter_t*p = device_config;
while(p) {
return pdf_doc;
}
+
+void pdf_destroy(gfxsource_t*src)
+{
+ if(!src->internal)
+ return;
+ gfxsource_internal_t*i = (gfxsource_internal_t*)src->internal;
+ free(src->internal);src->internal=0;
+}
gfxsource_t*gfxsource_pdf_create()
{
memset(src, 0, sizeof(gfxsource_t));
src->set_parameter = pdf_set_parameter;
src->open = pdf_open;
+ src->destroy = pdf_destroy;
src->internal = malloc(sizeof(gfxsource_internal_t));
memset(src->internal, 0, sizeof(gfxsource_internal_t));