[poppler] 2 commits - utils/pdftoppm.1 utils/pdftoppm.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Feb 28 02:13:34 PST 2012


 utils/pdftoppm.1  |   12 +++++++++---
 utils/pdftoppm.cc |    8 ++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 7ec31b8dc40ec8a3534fbb89964aa011aeb81f5e
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Feb 27 21:15:39 2012 +1030

    pdftoppm: document that -scale-to will preserve aspect ratio

diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1
index 17a3282..c7d5d6c 100644
--- a/utils/pdftoppm.1
+++ b/utils/pdftoppm.1
@@ -48,7 +48,9 @@ Specifies the X resolution, in DPI.  The default is 150 DPI.
 Specifies the Y resolution, in DPI.  The default is 150 DPI.
 .TP
 .BI \-scale-to " number"
-Scales each page to fit in scale-to*scale-to pixel box.
+Scales the long side of each page (width for landscape pages, height
+for portrait pages) to fit in scale-to pixels. The size of the short
+side will be determined by the aspect ratio of the page.
 .TP
 .BI \-scale-to-x " number"
 Scales each page horizontally to fit in scale-to-x pixels. If
commit 38ace7db5de0b2b247fd520e48a8f26e5d28c9d7
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Feb 25 20:02:22 2012 +1030

    pdftoppm: allow one of -scale-to-[xy] = -1 to mean the aspect ratio is to be preserved
    
    bug 43393

diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1
index 5fc81dc..17a3282 100644
--- a/utils/pdftoppm.1
+++ b/utils/pdftoppm.1
@@ -51,10 +51,14 @@ Specifies the Y resolution, in DPI.  The default is 150 DPI.
 Scales each page to fit in scale-to*scale-to pixel box.
 .TP
 .BI \-scale-to-x " number"
-Scales each page horizontally to fit in scale-to-x pixels.
+Scales each page horizontally to fit in scale-to-x pixels. If
+scale-to-y is set to -1, the vertical size will determined by the
+aspect ratio of the page.
 .TP
 .BI \-scale-to-y " number"
-Scales each page vertically to fit in scale-to-y pixels.
+Scales each page vertically to fit in scale-to-y pixels. If scale-to-x
+is set to -1, the horizontal size will determined by the aspect ratio
+of the page.
 .TP
 .BI \-x " number"
 Specifies the x-coordinate of the crop area top left corner
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 222c89b..5ceb0a0 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -389,11 +389,15 @@ int main(int argc, char *argv[]) {
       resolution = (72.0 * scaleTo) / (pg_w > pg_h ? pg_w : pg_h);
       x_resolution = y_resolution = resolution;
     } else {
-      if (x_scaleTo != 0) {
+      if (x_scaleTo > 0) {
         x_resolution = (72.0 * x_scaleTo) / pg_w;
+        if (y_scaleTo == -1)
+          y_resolution = x_resolution;
       }
-      if (y_scaleTo != 0) {
+      if (y_scaleTo > 0) {
         y_resolution = (72.0 * y_scaleTo) / pg_h;
+        if (x_scaleTo == -1)
+          x_resolution = y_resolution;
       }
     }
     pg_w = pg_w * (x_resolution / 72.0);


More information about the poppler mailing list