X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2FSWFOutputDev.cc;h=6af41024cb1fae099ab5facb6ea714980e097fc5;hb=4bf1addc537d33b0b4f22c3e5546634b5adee4e3;hp=41eda262852cb5448e45e0d7bf4238e6becb3138;hpb=c109dbef8cc11dd5de7292ba21c0628d1dc31857;p=swftools.git diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 41eda26..6af4102 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -23,6 +23,7 @@ #include #include //xpdf header files +#include "gfile.h" #include "GString.h" #include "gmem.h" #include "Object.h" @@ -408,7 +409,7 @@ T1_OUTLINE* gfxPath_to_T1_OUTLINE(GfxState*state, GfxPath*path) { int num = path->getNumSubpaths(); int s,t; - bezierpathsegment*start,*last; + bezierpathsegment*start,*last=0; bezierpathsegment*outline = start = new bezierpathsegment(); int cpos = 0; double lastx=0,lasty=0; @@ -547,7 +548,7 @@ void SWFOutputDev::beginString(GfxState *state, GString *s) state->getFontTransMat(&m11, &m12, &m21, &m22); m11 *= state->getHorizScaling(); m21 *= state->getHorizScaling(); - swfoutput_setfontmatrix(&output, m11, -m12, m21, -m22); + swfoutput_setfontmatrix(&output, m11, -m21, m12, -m22); } int charcounter = 0; @@ -630,6 +631,7 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) char*s = "-?-"; char*type = "-?-"; char*url = 0; + char*named = 0; int page = -1; switch(action->getKind()) { @@ -665,6 +667,7 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) GString*name = l->getName(); if(name) { s = name->lowerCase()->getCString(); + named = name->getCString(); if(strstr(s, "next") || strstr(s, "forward")) { page = currentpage + 1; @@ -731,6 +734,10 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) { swfoutput_linktourl(&output, url, points); } + else if(named) + { + swfoutput_namedlink(&output, named, points); + } logf(" \"%s\" link to \"%s\" (%d)\n", type, s, page); } } @@ -860,14 +867,14 @@ char*SWFOutputDev::writeEmbeddedFontToFile(GfxFont*font) ttfinfo = 1; } char name2[80]; - int r1 = lrand48(); - int r2 = lrand48(); - sprintf(name2,"%04x%04x",r1,r2); + char*tmp; + tmp = strdup(mktmpname((char*)name2)); + sprintf(name2, "%s", tmp); char*a[] = {"./ttf2pt1","-pttf","-b", tmpFileName, name2}; logf(" Invoking ttf2pt1..."); ttf2pt1_main(5,a); unlink(tmpFileName); - sprintf(name2,"%04x%04x.pfb",r1,r2); + sprintf(name2,"%s.pfb",tmp); tmpFileName = strdup(name2); } @@ -1138,7 +1145,7 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, if (str->getKind() == strDCT && (colorMap->getNumPixelComps() == 3 || !mask) ) { - sprintf(fileName, "/tmp/tmp%08x.jpg",lrand48()); + sprintf(fileName, "%s.jpg",mktmpname(0)); logf(" Found jpeg. Temporary storage is %s", fileName); if(!jpeginfo) { @@ -1195,7 +1202,7 @@ void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str, if(mask) { imgStr = new ImageStream(str, width, 1, 1); imgStr->reset(); - return; + //return; int yes=0,i,j; unsigned char buf[8]; int xid = 0; @@ -1527,7 +1534,7 @@ void pdfswf_performconversion() for(t=0;tdisplayPage((OutputDev*)output, currentpage, /*zoom*/100, /*rotate*/0, /*doLinks*/(int)1); + doc->displayPage((OutputDev*)output, currentpage, /*dpi*/72, /*rotate*/0, /*doLinks*/(int)1); } }