X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpdf2swf.c;h=45260197f3971c3efb1564c836b865e232db4dc7;hb=9f826653fb88e865129c686ccf09d2c700494068;hp=93628133ec93f1b9ad0ea908a021b6201386306a;hpb=79dda1a6768763e139d064ddedd1f733ad3dd238;p=swftools.git diff --git a/src/pdf2swf.c b/src/pdf2swf.c index 9362813..4526019 100644 --- a/src/pdf2swf.c +++ b/src/pdf2swf.c @@ -28,14 +28,12 @@ #ifdef HAVE_DIRENT_H #include #endif -#ifdef HAVE_SYS_STAT_H -#include -#endif #include "../lib/args.h" #include "../lib/os.h" #include "../lib/rfxswf.h" #include "../lib/devices/swf.h" #include "../lib/devices/arts.h" +#include "../lib/devices/record.h" #include "../lib/pdf/pdf.h" #include "../lib/log.h" @@ -416,6 +414,7 @@ void args_callback_usage(char*name) " graphic errors)\n"); printf("-s filloverlap Make intersecting shapes overlap, instead of canceling each\n" " other out. (Needed for some Powerpoint PDFs)\n"); + printf("-s transparent Make the SWF transparent\n"); //deliberately undocumented (for now) //printf("-2 Put 2 pages into each frame.\n"); //printf("-4 Put 4 pages into each frame.\n"); @@ -485,24 +484,12 @@ int main(int argn, char *argv[]) int nup_pos = 0; int x,y; char* installPath = getInstallationPath(); - char* fontdir = 0; initLog(0,-1,0,0,-1,loglevel); -#if defined(WIN32) && defined(HAVE_STAT) && defined(HAVE_SYS_STAT_H) if(installPath) { - fontdir = concatPaths(installPath, "fonts"); - FILE*test = fopen(concatPaths(fontdir,"\\d050000l.afm"), "rb"); - if(!test) { - fprintf(stderr, "Couldn't find file %s - pdf2swf not installed properly? OS says:\n", concatPaths(fontdir, "\\d050000l.afm")); - perror("open"); - exit(1); - } - fclose(test); + fontpaths[fontpathpos++] = concatPaths(installPath, "fonts"); } -#else - fontdir = concatPaths(installPath, "fonts"); -#endif #ifdef HAVE_SRAND48 srand48(time(0)); @@ -552,9 +539,6 @@ int main(int argn, char *argv[]) } /* add fonts */ - if(fontdir) { - driver->set_parameter("fontdir", fontdir); - } for(t=0;tset_parameter("fontdir", fontpaths[t]); } @@ -576,7 +560,7 @@ int main(int argn, char *argv[]) gfxdevice_t*out; if(flatten) { - gfxdevice_arts_init(&wrap, &swf); + gfxdevice_removeclippings_init(&wrap, &swf); out = &wrap; } else { out = &swf; @@ -673,6 +657,7 @@ int main(int argn, char *argv[]) } gfxresult_t*result = out->finish(out); + if(result->save(result, outputname) < 0) { exit(1); } @@ -685,44 +670,28 @@ int main(int argn, char *argv[]) pdf->destroy(pdf); - char*zip = ""; - if(zlib) + const char*zip = ""; + if(zlib) { zip = "-z"; -#undef SYSTEM_BACKTICKS - if(viewer && !preloader) { -#ifdef SYSTEM_BACKTICKS - systemf("swfcombine %s `swfdump -XY \"%s\"` \"%s\" viewport=\"%s\" -o \"%s\"",zip, - viewer, outputname, outputname); -#else + } + if(!preloader && viewer) { systemf("swfcombine %s -X %d -Y %d \"%s\" viewport=\"%s\" -o \"%s\"",zip,width,height, viewer, outputname, outputname); -#endif if(!system_quiet) printf("\n"); } if(preloader && !viewer) { msg(" --preloader option without --viewer option doesn't make very much sense."); -#ifdef SYSTEM_BACKTICKS - ret = systemf("swfcombine %s `swfdump -r \"%s\"` %s/PreLoaderTemplate.swf loader=\"%s\" movie=\"%s\" -o \"%s\"",zip, - preloader, SWFDIR, preloader, outputname, outputname); -#else ret = systemf("swfcombine %s -Y %d -X %d %s/PreLoaderTemplate.swf loader=\"%s\" movie=\"%s\" -o \"%s\"",zip,width,height, SWFDIR, preloader, outputname, outputname); -#endif if(!system_quiet) printf("\n"); } if(preloader && viewer) { systemf("swfcombine \"%s\" viewport=%s -o __tmp__.swf", - viewer, outputname, outputname); -#ifdef SYSTEM_BACKTICKS - systemf("swfcombine %s `swfdump -XY \"%s\"` `swfdump -r \"%s\"` %s/PreLoaderTemplate.swf loader=%s movie=__tmp__.swf -o \"%s\"",zip, - outputname, preloader, SWFDIR, preloader, outputname); -#else - /* TODO: read out rate */ + viewer, outputname); systemf("swfcombine %s -X %d -Y %d -r %f %s/PreLoaderTemplate.swf loader=%s movie=__tmp__.swf -o \"%s\"",zip,width,height, - getRate(preloader), preloader, SWFDIR, preloader, outputname); -#endif + getRate(preloader), SWFDIR, preloader, outputname); systemf("rm __tmp__.swf"); }