X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2FSWFOutputDev.cc;h=23f12580ca77324106c12933682d61cb23cadef5;hb=8445d187ed4cc19ceae8d4d0f369ef055ae7013b;hp=f6274bbc629167a9fa163ec4de7f8e72ec78f031;hpb=b8573ee9e8a629c9a19f614ca3c4d64c93901eab;p=swftools.git diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index f6274bb..23f1258 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -386,35 +386,35 @@ void dumpFontInfo(char*loglevel, GfxFont*font) GString*gstr = font->getTag(); - msg("%sTag: %s\n", loglevel, name); + msg("%s| Tag: %s\n", loglevel, name); - if(font->isCIDFont()) msg("%sis CID font\n", loglevel); + if(font->isCIDFont()) msg("%s| is CID font\n", loglevel); GfxFontType type=font->getType(); switch(type) { case fontUnknownType: - msg("%sType: unknown\n",loglevel); + msg("%s| Type: unknown\n",loglevel); break; case fontType1: - msg("%sType: 1\n",loglevel); + msg("%s| Type: 1\n",loglevel); break; case fontType1C: - msg("%sType: 1C\n",loglevel); + msg("%s| Type: 1C\n",loglevel); break; case fontType3: - msg("%sType: 3\n",loglevel); + msg("%s| Type: 3\n",loglevel); break; case fontTrueType: - msg("%sType: TrueType\n",loglevel); + msg("%s| Type: TrueType\n",loglevel); break; case fontCIDType0: - msg("%sType: CIDType0\n",loglevel); + msg("%s| Type: CIDType0\n",loglevel); break; case fontCIDType0C: - msg("%sType: CIDType0C\n",loglevel); + msg("%s| Type: CIDType0C\n",loglevel); break; case fontCIDType2: - msg("%sType: CIDType2\n",loglevel); + msg("%s| Type: CIDType2\n",loglevel); break; } @@ -423,18 +423,18 @@ void dumpFontInfo(char*loglevel, GfxFont*font) if(font->getEmbeddedFontName()) name = font->getEmbeddedFontName()->getCString(); if(embedded) - msg("%sEmbedded name: %s id: %d\n",loglevel, FIXNULL(name), embRef.num); + msg("%s| Embedded name: %s id: %d\n",loglevel, FIXNULL(name), embRef.num); gstr = font->getExtFontFile(); if(gstr) - msg("%sExternal Font file: %s\n", loglevel, FIXNULL(gstr->getCString())); + msg("%s| External Font file: %s\n", loglevel, FIXNULL(gstr->getCString())); // Get font descriptor flags. - if(font->isFixedWidth()) msg("%sis fixed width\n", loglevel); - if(font->isSerif()) msg("%sis serif\n", loglevel); - if(font->isSymbolic()) msg("%sis symbolic\n", loglevel); - if(font->isItalic()) msg("%sis italic\n", loglevel); - if(font->isBold()) msg("%sis bold\n", loglevel); + if(font->isFixedWidth()) msg("%s| is fixed width\n", loglevel); + if(font->isSerif()) msg("%s| is serif\n", loglevel); + if(font->isSymbolic()) msg("%s| is symbolic\n", loglevel); + if(font->isItalic()) msg("%s| is italic\n", loglevel); + if(font->isBold()) msg("%s| is bold\n", loglevel); } //void SWFOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) {printf("void SWFOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) \n");} @@ -617,12 +617,11 @@ SWFOutputDev::~SWFOutputDev() }; GBool SWFOutputDev::upsideDown() { - msg(" upsidedown?"); + msg(" upsidedown? yes"); return gTrue; }; GBool SWFOutputDev::useDrawChar() { - msg(" usedrawchar?"); return gTrue; } @@ -660,8 +659,6 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, if(_u) u = *_u; - msg(" drawChar(%f,%f,%f,%f,c='%c' (%d),u=%d <%d>) CID=%d\n",x,y,dx,dy,c,c,u, uLen, font->isCIDFont()); - /* find out the character name */ char*name=0; if(font->isCIDFont() && u) { @@ -681,13 +678,13 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, if(enc && enc[c]) name = enc[c]; } + + msg(" drawChar(%f,%f,c='%c' (%d),u=%d <%d>) CID=%d name=\"%s\"\n",x1,y1,(c&127)>=32?c:'?',c,u, uLen, font->isCIDFont(), FIXNULL(name)); int ret = swfoutput_drawchar(&output, x1, y1, name, c, u); } -void SWFOutputDev::endString(GfxState *state) -{ - msg(" endstring\n"); +void SWFOutputDev::endString(GfxState *state) { } @@ -710,18 +707,25 @@ void SWFOutputDev::endType3Char(GfxState *state) void SWFOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2) { double x1,y1,x2,y2; + int rot = doc->getPageRotate(1); laststate = state; msg(" startPage %d (%f,%f,%f,%f)\n", pageNum, crop_x1, crop_y1, crop_x2, crop_y2); + if(rot!=0) + msg(" page is rotated %d degrees\n", rot); + msg(" processing page %d", pageNum); /* state->transform(state->getX1(),state->getY1(),&x1,&y1); state->transform(state->getX2(),state->getY2(),&x2,&y2); Use CropBox, not MediaBox, as page size */ - x1 = crop_x1; + + /*x1 = crop_x1; y1 = crop_y1; x2 = crop_x2; - y2 = crop_y2; + y2 = crop_y2;*/ + state->transform(crop_x1,crop_y1,&x1,&y1); + state->transform(crop_x2,crop_y2,&x2,&y2); if(x2getType() == fontType1 || - gfxFont->getType() == fontCIDType0C || + //gfxFont->getType() == fontCIDType0C || gfxFont->getType() == fontType1C || gfxFont->getType() == fontTrueType || gfxFont->getType() == fontCIDType2 @@ -1178,9 +1182,10 @@ void SWFOutputDev::updateFont(GfxState *state) } msg(" updateFont(%s) -> %s", fontname, fileName); + dumpFontInfo("", gfxFont); swfoutput_setfont(&output, fontname, fileName); - + if(fileName && del) unlinkfont(fileName); } @@ -1609,15 +1614,9 @@ void pdfswf_init(char*filename, char*userPassword) } } info.free(); - + numpages = doc->getNumPages(); if (doc->isEncrypted()) { - /*ERROR: This pdf is encrypted, and disallows copying. - Due to the DMCA, paragraph 1201, (2) A-C, circumventing - a technological measure that efficively controls access to - a protected work is violating American law. - See www.eff.org for more information about DMCA issues. - */ if(!doc->okToCopy()) { printf("PDF disallows copying. Bailing out.\n"); exit(1); //bail out