X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=pdf2swf%2FSWFOutputDev.cc;h=d26267421c99ad218e9abab96618b176c3fba4b5;hb=84fbf70eec7a04cb3a3e42ee610f7673d39d4926;hp=bffb3b5bcfaf80328f670e5bbd1e64c400949ab2;hpb=9678c99d4d8db8a81dc8b09d2d4e3431d72243ce;p=swftools.git diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index bffb3b5..d262674 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -59,10 +59,6 @@ int pagepos = 0; static void printInfoString(Dict *infoDict, char *key, char *fmt); static void printInfoDate(Dict *infoDict, char *key, char *fmt); -static char userPassword[33] = ""; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; - double fontsizes[] = { 0.833,0.833,0.889,0.889,0.788,0.722,0.833,0.778,0.600,0.600,0.600,0.600,0.576,0.576,0.576,0.576 @@ -233,8 +229,11 @@ public: int setT1Font(char*name,FontEncoding*enc); int t1id; - int jpeginfo; // did we write "Page contains jpegs" yet? - int pbminfo; // did we write "Page contains jpegs" yet? + int jpeginfo; // did we write "File contains jpegs" yet? + int pbminfo; // did we write "File contains jpegs" yet? + int linkinfo; // did we write "File contains links" yet? + + GfxState *laststate; }; char mybuf[1024]; @@ -431,6 +430,7 @@ void dumpFontInfo(char*loglevel, GfxFont*font) SWFOutputDev::SWFOutputDev() { jpeginfo = 0; + linkinfo = 0; pbminfo = 0; clippos = 0; clipping[clippos] = 0; @@ -577,7 +577,7 @@ GBool SWFOutputDev::useDrawChar() void SWFOutputDev::beginString(GfxState *state, GString *s) { double m11,m21,m12,m22; - logf(" beginstring \"%s\"\n", s->getCString()); +// logf(" %s beginstring \"%s\"\n", gfxstate2str(state), s->getCString()); state->getFontTransMat(&m11, &m12, &m21, &m22); m11 *= state->getHorizScaling(); m21 *= state->getHorizScaling(); @@ -619,6 +619,7 @@ void SWFOutputDev::endString(GfxState *state) void SWFOutputDev::startPage(int pageNum, GfxState *state) { double x1,y1,x2,y2; + laststate = state; logf(" startPage %d\n", pageNum); logf(" processing page %d", pageNum); @@ -645,16 +646,16 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) rgb.r = 0; rgb.g = 0; rgb.b = 1; - cvtu2d(this, x1, y1, &x, &y); + cvtUserToDev(x1, y1, &x, &y); points[0].x = points[4].x = (int)x; points[0].y = points[4].y = (int)y; - cvtu2d(this, x2, y1, &x, &y); + cvtUserToDev(x2, y1, &x, &y); points[1].x = (int)x; points[1].y = (int)y; - cvtu2d(this, x2, y2, &x, &y); + cvtUserToDev(x2, y2, &x, &y); points[2].x = (int)x; points[2].y = (int)y; - cvtu2d(this, x1, y2, &x, &y); + cvtUserToDev(x1, y2, &x, &y); points[3].x = (int)x; points[3].y = (int)y; @@ -746,6 +747,11 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) break; } } + if(!linkinfo && (page || url)) + { + logf(" File contains links"); + linkinfo = 1; + } if(page>0) { int t; @@ -759,7 +765,7 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) { swfoutput_linktourl(&output, url, points); } - logf(" \"%s\" link to \"%s\" (%d)\n", type, s, page); + logf(" \"%s\" link to \"%s\" (%d)\n", type, s, page); } } @@ -809,6 +815,7 @@ int SWFOutputDev::setT1Font(char*name, FontEncoding*encoding) return 0; this->t1id = id; + return 1; } void SWFOutputDev::updateLineWidth(GfxState *state) @@ -908,6 +915,8 @@ void SWFOutputDev::updateFont(GfxState *state) char * fontname = 0; GfxFont*gfxFont = state->getFont(); char * fileName = 0; + +// logf(" %s updateFont\n", gfxstate2str(state)); if (!gfxFont) { return; @@ -1317,6 +1326,11 @@ void pdfswf_linksopennewwindow() opennewwindow = 1; } +void pdfswf_storeallcharacters() +{ + storeallcharacters = 1; +} + void pdfswf_jpegquality(int val) { if(val<0) val=0;