X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpdf2swf.c;h=c50a3de3c8e0ece3997f150dcef00e02f8f440b9;hb=a61b92b4ac72cd15ee0f3165f2e7a2f5ac00f156;hp=5b258d1aca17c2f6f742bcbf8e8cedfb9bba0130;hpb=fe0bf96d27b7af11538533b4df9eca5cbc96eedf;p=swftools.git diff --git a/src/pdf2swf.c b/src/pdf2swf.c index 5b258d1..c50a3de 100644 --- a/src/pdf2swf.c +++ b/src/pdf2swf.c @@ -640,18 +640,20 @@ int main(int argn, char *argv[]) exit(1); } - if(!outputname) - { - if(filename) { - outputname = stripFilename(filename, ".swf"); - msg(" Output filename not given. Writing to %s", outputname); - } - } - - if(!outputname) - { - fprintf(stderr, "Please use -o to specify an output file\n"); - exit(1); + if (!info_only) { + if(!outputname) + { + if(filename) { + outputname = stripFilename(filename, ".swf"); + msg(" Output filename not given. Writing to %s", outputname); + } + } + + if(!outputname) + { + fprintf(stderr, "Please use -o to specify an output file\n"); + exit(1); + } } // test if the page range is o.k. @@ -671,16 +673,16 @@ int main(int argn, char *argv[]) if(pagerange) driver->set_parameter(driver, "pages", pagerange); - if(info_only) { - show_info(driver, filename); - return 0; - } - /* add fonts */ for(t=0;tset_parameter(driver, "fontdir", fontpaths[t]); } + if(info_only) { + show_info(driver, filename); + return 0; + } + char*u = 0; if((u = strchr(outputname, '%'))) { if(strchr(u+1, '%') || @@ -738,10 +740,16 @@ int main(int argn, char *argv[]) frame++; } } + if(pagerange && !pagenum && frame==1) { + fprintf(stderr, "No pages in range %s", pagerange); + exit(1); + } pagenum = 0; gfxdevice_t*out = create_output_device();; + pdf->prepare(pdf, out); + for(pagenr = 1; pagenr <= pdf->num_pages; pagenr++) { if(is_in_range(pagenr, pagerange)) {