X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpdf2swf.c;h=e68bb7c06513a8589a0c9aab5c2e6ef78efd6db0;hb=7528e9af6df5b0d27fc6d27158ab3cc51d6cbf64;hp=a011db66293c191cd8047a81dd559ff288598d7b;hpb=a6b1b244a6d5114fbfb3102ff370a46511b217d9;p=swftools.git diff --git a/src/pdf2swf.c b/src/pdf2swf.c index a011db6..e68bb7c 100644 --- a/src/pdf2swf.c +++ b/src/pdf2swf.c @@ -42,6 +42,7 @@ #include "../lib/devices/swf.h" #include "../lib/devices/polyops.h" #include "../lib/devices/record.h" +#include "../lib/devices/rescale.h" #include "../lib/pdf/pdf.h" #include "../lib/log.h" @@ -50,6 +51,8 @@ static gfxsource_t*driver = 0; static gfxdevice_t*out = 0; +static int maxwidth=0, maxheight=0; + static char * outputname = 0; static int loglevel = 3; static char * pagerange = 0; @@ -181,6 +184,16 @@ int args_callback_option(char*name,char*val) { ynup = 3; return 0; } + else if (!strcmp(name, "X")) + { + maxwidth = atoi(val); + return 1; + } + else if (!strcmp(name, "Y")) + { + maxheight = atoi(val); + return 1; + } else if (!strcmp(name, "q")) { loglevel --; @@ -468,6 +481,8 @@ static struct options_t options[] = { {"G", "flatten"}, {"I", "info"}, {"Q", "maxtime"}, +{"X", "width"}, +{"Y", "height"}, {0,0} }; @@ -572,15 +587,24 @@ void show_info(gfxsource_t*driver, char*filename) } -static gfxdevice_t swf,wrap; +static gfxdevice_t swf,wrap,rescale; gfxdevice_t*create_output_device() { gfxdevice_swf_init(&swf); - gfxdevice_removeclippings_init(&wrap, &swf); - out = &wrap; - if(!flatten) { - out = &swf; + + /* set up filter chain */ + + out = &swf; + if(flatten) { + gfxdevice_removeclippings_init(&wrap, &swf); + out = &wrap; } + + if(maxwidth || maxheight) { + gfxdevice_rescale_init(&rescale, out, maxwidth, maxheight, 0); + out = &rescale; + } + /* pass global parameters to output device */ parameter_t*p = device_config; while(p) {