diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2012-02-25 20:02:22 +1030 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2012-02-28 20:43:00 +1030 |
commit | 38ace7db5de0b2b247fd520e48a8f26e5d28c9d7 (patch) | |
tree | 0d6a8961c141e57dac72f59f2677a1fe3181749f /utils | |
parent | 738b879ebb536cc84d7ec96543d484023b69e6d3 (diff) |
pdftoppm: allow one of -scale-to-[xy] = -1 to mean the aspect ratio is to be preserved
bug 43393
Diffstat (limited to 'utils')
-rw-r--r-- | utils/pdftoppm.1 | 8 | ||||
-rw-r--r-- | utils/pdftoppm.cc | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1 index 5fc81dca..17a3282f 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 222c89be..5ceb0a0e 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); |