X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fpdf2swf.cc;h=79e6cb29ff7b82150aff8117a0f29267422933eb;hb=91f07304c9e9687652450f53938d76e1f60ddf76;hp=0d8179627608989f35911aca9ff2be2ba3187018;hpb=fc554a43712b76d16b41ec77dd311b4a78b1ef6b;p=swftools.git diff --git a/pdf2swf/pdf2swf.cc b/pdf2swf/pdf2swf.cc index 0d81796..79e6cb2 100644 --- a/pdf2swf/pdf2swf.cc +++ b/pdf2swf/pdf2swf.cc @@ -12,7 +12,7 @@ #include #include #include "../config.h" -#include "args.h" +#include "../lib/args.h" #include "pdfswf.h" #include "t1lib.h" extern "C" { @@ -56,6 +56,36 @@ int args_callback_option(char*name,char*val) { password = val; return 1; } + else if (!strcmp(name, "s")) + { + pdfswf_drawonlyshapes(); + return 0; + } + else if (!strcmp(name, "i")) + { + pdfswf_ignoredraworder(); + return 0; + } + else if (!strcmp(name, "n")) + { + pdfswf_linksopennewwindow(); + return 0; + } + else if (!strcmp(name, "f")) + { + pdfswf_storeallcharacters(); + return 0; + } + else if (name[0]=='j') + { + if(name[1]) { + pdfswf_jpegquality(atoi(&name[1])); + return 0; + } else { + pdfswf_jpegquality(atoi(val)); + return 1; + } + } else if (!strcmp(name, "V")) { printf("pdf2swf - part of %s %s\n", PACKAGE, VERSION); @@ -69,36 +99,20 @@ int args_callback_option(char*name,char*val) { return 0; } -struct options_t -{ - char shortoption; - char*longoption; -} options[] = -{{'o',"output"}, - {'V',"version"}, - {'p',"pages"} +struct options_t options[] = +{{"o","output"}, + {"V","version"}, + {"i","ignore"}, + {"s","shapes"}, + {"j","jpegquality"}, + {"p","pages"}, + {"w","samewindow"}, + {"f","fonts"}, + {0,0} }; int args_callback_longoption(char*name,char*val) { - int t; - char*equal = strchr(name,'='); - if (equal) { - *equal = 0; - equal++; - } - for(t=0;t='0' && *digits<='9') - digits++; - if(digits == pos) { - fprintf(stderr, "Error: \"%s\" is not a valid format (digit expected)\n",irange); - exit(1); - } - - tmp=*digits;*digits=0; - num = atoi(pos); - *digits=tmp; - pos = digits; - - while(*pos == ' ' || *pos == '\r' || *pos == '\n' || *pos == '\t') - pos++; - - if(range && last<=t && num>=t) - return 1; - if(range) { - range = 0; - if(*pos) - pos ++; - continue; - } - - if(*pos=='-') - { - if(range) { - fprintf(stderr, "Error: \"%s\" is not a valid format (too many '-'s)\n",irange); - exit(1); - } - last = num; - range = 1; - if(*pos) - pos ++; - continue; - } - else - { - /* if it isn't a '-', we assume it is a seperator like - ',', ';', ':', whatever. */ - if(t == num) - return 1; - if(*pos) - pos ++; - continue; - } - } - if(range && last<=t) - return 1; - return 0; + printf("-p --pages=range Convert only pages in range\n"); + printf("-P --password=password Use password for deciphering the pdf\n"); + printf("-s --shapes Don't use SWF Fonts, but store everything as shape\n"); + printf("-i --ignore Ignore draw order (makes the SWF file smaller)\n"); + printf("-j --jpegquality=quality Set quality of embedded jpeg pictures (default:85)\n"); + printf("-v --verbose Be verbose. Use more than one -v for greater effect\n"); + printf("-w --samewindow Don't open a new Browser Window for Links in the SWF\n"); + printf("-f --fonts Store full fonts in SWF. (Don't reduce to used characters)\n"); + printf("-V --version Print program version\n"); } int main(int argn, char *argv[]) { +#ifdef HAVE_SRAND48 + srand48(time(0)); +#else +#ifdef HAVE_SRAND + srand(time(0)); +#endif +#endif processargs(argn, argv); initLog(0,-1,0,0,-1,loglevel); + if(!outputname) + { + fprintf(stderr, "Please use -o to specify an output file\n"); + exit(1); + } // test if the page range is o.k. is_in_range(0x7fffffff, pagerange); @@ -241,6 +198,7 @@ int main(int argn, char *argv[]) if(is_in_range(t, pagerange)) pdfswf_convertpage(t); } + pdfswf_performconversion(); pdfswf_close(); return 0;