webkitpdf.vala
authorAlan Knowles <alan@roojs.com>
Mon, 25 Apr 2016 07:39:45 +0000 (15:39 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 25 Apr 2016 07:39:45 +0000 (15:39 +0800)
webkitpdf.vala

index c0f50b4..f65a63f 100644 (file)
@@ -13,7 +13,7 @@ public class webkitpdf {
                        
                        { "url", 0, 0, OptionArg.STRING, ref opt_url, "Url to grab", null },
                        { "delay", 0, 0, OptionArg.INT, ref opt_delay, "Delay before snapshot in seconds", null },
-                       //{ "png", 0, 0, OptionArg.STRING, ref opt_target_png, "File to write (PNG)", null },
+                       { "png", 0, 0, OptionArg.STRING, ref opt_target_png, "File to write (PNG)", null },
                        { "inject", 0, 0, OptionArg.STRING_ARRAY, ref opt_inject_js, "Inject Javascript file(s)", null },
                        { "pdf", 0, 0, OptionArg.STRING, ref opt_target_pdf, "File to write (PDF)", null },
                        { null }
@@ -39,9 +39,9 @@ public class webkitpdf {
             if (webkitpdf.opt_url == null) {
                 throw new OptionError.BAD_VALUE("missing url");
             }
-                       //if (webkitpdf.opt_target_png == null) {
-            //    throw new OptionError.BAD_VALUE("missing png"  file path);
-            //}
+                       if (webkitpdf.opt_target_png == null && webkitpdf.opt_target_pdf == null) {
+                throw new OptionError.BAD_VALUE("missing pdf or png filename");
+            }
             if (webkitpdf.opt_target_pdf == null) {
                 throw new OptionError.BAD_VALUE("missing pdf file path");
             }