if page range is given and % filename syntax is used, name files according to page...
[swftools.git] / src / pdf2swf.c
index 8c4d8a5..1c476c1 100644 (file)
@@ -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"
 
@@ -185,12 +186,12 @@ int args_callback_option(char*name,char*val) {
     }
     else if (!strcmp(name, "X"))
     {
-        maxwidth = atoi(value);
+        maxwidth = atoi(val);
        return 1;
     }
     else if (!strcmp(name, "Y"))
     {
-        maxheight = atoi(value);
+        maxheight = atoi(val);
        return 1;
     }
     else if (!strcmp(name, "q"))
@@ -600,7 +601,7 @@ gfxdevice_t*create_output_device()
     }
 
     if(maxwidth || maxheight) {
-        gfxdevice_rescale_init(&rescale, out, maxwidth, maxheight);
+        gfxdevice_rescale_init(&rescale, out, maxwidth, maxheight, 0);
         out = &rescale;
     }
 
@@ -824,7 +825,7 @@ int main(int argn, char *argv[])
            if(one_file_per_page) {
                gfxresult_t*result = out->finish(out);out=0;
                char buf[1024];
-               sprintf(buf, outputname, one_file_per_page++);
+               sprintf(buf, outputname, pagenr);
                if(result->save(result, buf) < 0) {
                    return 1;
                }