+ delete globalParams;globalParams=0;
+ Object::memCheck(stderr);
+ gMemReport(stderr);
+ }
+} myMemCheck;
+
+void pdf_destroy(pdf_doc_t*pdf_doc)
+{
+ pdf_doc_internal_t*i= (pdf_doc_internal_t*)pdf_doc->internal;
+
+ msg("<debug> pdfswf.cc: pdfswf_close()");
+ delete i->doc; i->doc=0;
+
+ free(pages); pages = 0; //FIXME
+
+ free(pdf_doc->internal);pdf_doc->internal=0;
+ free(pdf_doc);pdf_doc=0;
+}
+
+pdf_page_t* pdf_getpage(pdf_doc_t*pdf_doc, int page)
+{
+ pdf_doc_internal_t*di= (pdf_doc_internal_t*)pdf_doc->internal;
+
+ if(page < 1 || page > pdf_doc->num_pages)
+ return 0;
+
+ pdf_page_t* pdf_page = (pdf_page_t*)malloc(sizeof(pdf_page_t));
+ pdf_page_internal_t*pi= (pdf_page_internal_t*)malloc(sizeof(pdf_page_internal_t));
+ memset(pi, 0, sizeof(pdf_page_internal_t));
+ pdf_page->internal = pi;
+
+ pdf_page->parent = pdf_doc;
+ pdf_page->nr = page;
+ return pdf_page;
+}
+
+void pdf_page_destroy(pdf_page_t*pdf_page)
+{
+ pdf_page_internal_t*i= (pdf_page_internal_t*)pdf_page->internal;
+ free(pdf_page->internal);pdf_page->internal = 0;
+ free(pdf_page);pdf_page=0;
+}
+
+swf_output_t* swf_output_init()
+{
+ swf_output_t*swf_output = (swf_output_t*)malloc(sizeof(swf_output_t));
+ memset(swf_output, 0, sizeof(swf_output_t));
+ swf_output_internal_t*i= (swf_output_internal_t*)malloc(sizeof(swf_output_internal_t));
+ memset(i, 0, sizeof(swf_output_internal_t));
+ swf_output->internal = i;
+
+ i->outputDev = new SWFOutputDev();
+ return swf_output;
+}
+
+void swf_output_setparameter(swf_output_t*swf_output, char*name, char*value)
+{
+ /* FIXME */
+ pdfswf_setparameter(name, value);
+}
+
+void swf_output_pagefeed(swf_output_t*swf)
+{
+ swf_output_internal_t*i= (swf_output_internal_t*)swf->internal;
+ i->outputDev->pagefeed();
+ i->outputDev->getDimensions(&swf->x1, &swf->y1, &swf->x2, &swf->y2);
+}
+
+int swf_output_save(swf_output_t*swf, char*filename)
+{
+ swf_output_internal_t*i= (swf_output_internal_t*)swf->internal;
+ int ret = i->outputDev->save(filename);
+ i->outputDev->getDimensions(&swf->x1, &swf->y1, &swf->x2, &swf->y2);
+ return ret;
+}
+
+void* swf_output_get(swf_output_t*swf)
+{
+ swf_output_internal_t*i= (swf_output_internal_t*)swf->internal;
+ void* ret = i->outputDev->getSWF();
+ i->outputDev->getDimensions(&swf->x1, &swf->y1, &swf->x2, &swf->y2);
+ return ret;
+}
+
+void swf_output_destroy(swf_output_t*output)
+{
+ swf_output_internal_t*i = (swf_output_internal_t*)output->internal;
+ delete i->outputDev; i->outputDev=0;
+ free(output->internal);output->internal=0;
+ free(output);
+}
+
+void pdf_page_render2(pdf_page_t*page, swf_output_t*swf)
+{
+ pdf_doc_internal_t*pi = (pdf_doc_internal_t*)page->parent->internal;
+ swf_output_internal_t*si = (swf_output_internal_t*)swf->internal;
+
+ if(pi->protect) {
+ swfoutput_setparameter("protect", "1");
+ }
+ si->outputDev->setXRef(pi->doc, pi->doc->getXRef());