[poppler] utils/pdftocairo.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Mon Jan 11 03:32:10 PST 2016


 utils/pdftocairo.cc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 3bfc45bfcca1a52447cedbb95afad1ef362ac6f0
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Jan 11 21:46:49 2016 +1030

    pdftocairo: check for invalid use of -scale-to* and -paper[wh] options
    
    Bug 92195

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index a7257b4..b795b7b 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -835,8 +835,10 @@ int main(int argc, char *argv[]) {
   int num_outputs;
 
   // parse args
-  if (!parseArgs(argDesc, &argc, argv))
+  if (!parseArgs(argDesc, &argc, argv)) {
+    printUsage("pdftocairo", 0, argDesc);
     exit(99);
+  }
 
   if ( resolution != 0.0 &&
        (x_resolution == 150.0 ||
@@ -886,6 +888,9 @@ int main(int argc, char *argv[]) {
     checkInvalidPrintOption(icc.getCString()[0], "-icc");
     checkInvalidPrintOption(singleFile, "-singlefile");
     checkInvalidPrintOption(useCropBox, "-cropbox");
+    checkInvalidPrintOption(scaleTo != 0, "-scale-to");
+    checkInvalidPrintOption(x_scaleTo != 0, "-scale-to-x");
+    checkInvalidPrintOption(y_scaleTo != 0, "-scale-to-y");
   } else {
     checkInvalidImageOption(level2, "-level2");
     checkInvalidImageOption(level3, "-level3");
@@ -940,6 +945,11 @@ int main(int argc, char *argv[]) {
     exit(99);
   }
 
+  if ((paperWidth > 0 && paperHeight <= 0) || (paperWidth <= 0 && paperHeight > 0)) {
+    fprintf(stderr, "Error: both -paperw and -paperh must be specified.\n");
+    exit(99);
+  }
+
   if (paperSize[0]) {
     if (origPageSizes) {
       fprintf(stderr, "Error: -origpagesizes and -paper may not be used together.\n");


More information about the poppler mailing list