X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=src%2Fpdf2swf.c;h=e333eb3a9a9ab8ac02d2148acddbf2b95f368cd2;hp=c7a804ee64f00aa7f3fbabe874f5e0e4739c359e;hb=905772d04a1c2dd73802c6dde5bd50e9701b7af6;hpb=c34a9e0500bc5141864683ff548b8979f611747b diff --git a/src/pdf2swf.c b/src/pdf2swf.c index c7a804e..e333eb3 100644 --- a/src/pdf2swf.c +++ b/src/pdf2swf.c @@ -72,6 +72,8 @@ static int max_time = 0; static int flatten = 0; +static char* filters = 0; + char* fontpaths[256]; int fontpathpos = 0; @@ -335,6 +337,20 @@ int args_callback_option(char*name,char*val) { store_parameter("extrafontdata", "1"); return 0; } + else if (!strcmp(name, "ff")) + { + if(filters) { + // append this to the current filter expression (we allow more than one --filter) + int l = strlen(filters); + int new_len = l + strlen(val) + 2; + filters = (char*)realloc(filters, new_len); + filters[l] = ':'; + strcpy(filters+l+1, val); + } else { + filters = strdup(val); + } + return 1; + } else if (!strcmp(name, "w")) { store_parameter("linksopennewwindow", "0"); @@ -455,6 +471,7 @@ static struct options_t options[] = { {"t", "stop"}, {"T", "flashversion"}, {"F", "fontdir"}, +{"ff", "filter"}, {"b", "defaultviewer"}, {"l", "defaultloader"}, {"B", "viewer"}, @@ -589,6 +606,16 @@ gfxdevice_t*create_output_device() out = &rescale; } + if(filters) { + gfxfilterchain_t*chain = gfxfilterchain_parse(filters); + if(!chain) { + fprintf(stderr, "Unable to parse filters: %s\n", filters); + exit(1); + } + out = gfxfilterchain_apply(chain, out); + gfxfilterchain_destroy(chain); + } + /* pass global parameters to output device */ parameter_t*p = device_config; while(p) { @@ -888,6 +915,9 @@ int main(int argn, char *argv[]) p->next = 0;free(p); p = next; } + if(filters) { + free(filters); + } return 0; }