X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpdf2pdf.c;fp=src%2Fpdf2pdf.c;h=faa8d1b6dc415c3c3db3bb7237196c70356bd891;hb=0e9d27093c3e6e8e316fbc08bb9d422d74da2fd1;hp=f642df6af0911f1991cf7fa3136911df99ebefa9;hpb=ecd7c7248b9a93163090bfe7512b2a53d8da6d95;p=swftools.git diff --git a/src/pdf2pdf.c b/src/pdf2pdf.c index f642df6..faa8d1b 100644 --- a/src/pdf2pdf.c +++ b/src/pdf2pdf.c @@ -40,6 +40,8 @@ static gfxsource_t*driver = 0; +static int maxwidth = 0; +static int maxheight = 0; static char * outputname = 0; static int loglevel = 3; static char * pagerange = 0; @@ -100,6 +102,16 @@ int args_callback_option(char*name,char*val) { free(s); return 1; } + else if (!strcmp(name, "X")) + { + maxwidth = atoi(val); + return 1; + } + else if (!strcmp(name, "Y")) + { + maxheight = atoi(val); + return 1; + } else if (!strcmp(name, "V")) { printf("pdf2swf - part of %s %s\n", PACKAGE, VERSION); @@ -193,7 +205,7 @@ int main(int argn, char *argv[]) } gfxdocument_t* doc = driver->open(driver, filename); - doc->set_parameter(doc, "drawonlyshapes", "1"); + //doc->set_parameter(doc, "drawonlyshapes", "1"); doc->set_parameter(doc, "disable_polygon_conversion", "1"); if(!doc) { @@ -208,6 +220,13 @@ int main(int argn, char *argv[]) gfxdevice_removeclippings_init(&wrap, out); out = &wrap;*/ + gfxdevice_t rescale; + if(maxwidth || maxheight) { + gfxdevice_rescale_init(&rescale, out, maxwidth, maxheight, 0); + out = &rescale; + out->setparameter(out, "keepratio", "1"); + } + int pagenr; for(pagenr = 1; pagenr <= doc->num_pages; pagenr++) {