[poppler] 2 commits - utils/pdftocairo.1 utils/pdftocairo.cc
Adrian Johnson
ajohnson at kemper.freedesktop.org
Thu Mar 1 03:18:03 PST 2012
utils/pdftocairo.1 | 12 +++++++++---
utils/pdftocairo.cc | 8 ++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
New commits:
commit e63ca8184168f824575be9bbb64e9b1eac1eff94
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Thu Mar 1 21:46:12 2012 +1030
pdftocairo: document that -scale-to will preserve aspect ratio
based on pdftpppm patch 7ec31b8dc40ec8a3534fbb89964aa011aeb81f5e
diff --git a/utils/pdftocairo.1 b/utils/pdftocairo.1
index d02095e..19b62ef 100644
--- a/utils/pdftocairo.1
+++ b/utils/pdftocairo.1
@@ -112,7 +112,9 @@ Specifies the X resolution, in pixels per inch of image files (or rasterized reg
Specifies the Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI.
.TP
.BI \-scale-to " number"
-Scales each page to fit in scale-to*scale-to pixel box (PNG/JPEG only).
+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 (PNG/JPEG only).
.TP
.BI \-scale-to-x " number"
Scales each page horizontally to fit in scale-to-x pixels. If
commit fa82a7ce1372e5976ad95624115fcd7a4d9bd22c
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Thu Mar 1 21:43:32 2012 +1030
pdftocairo: allow one of -scale-to-[xy] = -1 to mean the aspect ratio is to be preserved
based on pdftoppm patch 38ace7db5de0b2b247fd520e48a8f26e5d28c9d7
diff --git a/utils/pdftocairo.1 b/utils/pdftocairo.1
index 28e181f..d02095e 100644
--- a/utils/pdftocairo.1
+++ b/utils/pdftocairo.1
@@ -115,10 +115,14 @@ Specifies the Y resolution, in pixels per inch of image files (or rasterized reg
Scales each page to fit in scale-to*scale-to pixel box (PNG/JPEG only).
.TP
.BI \-scale-to-x " number"
-Scales each page horizontally to fit in scale-to-x pixels (PNG/JPEG only).
+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 (PNG/JPEG only).
.TP
.BI \-scale-to-y " number"
-Scales each page vertically to fit in scale-to-y pixels (PNG/JPEG only).
+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 (PNG/JPEG only).
.TP
.BI \-x " number"
Specifies the x-coordinate of the crop area top left corner in pixels (image output) or points (vector output)
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 0d920ac..2eeb751 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -952,11 +952,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;
}
}
if ((doc->getPageRotate(pg) == 90) || (doc->getPageRotate(pg) == 270)) {
More information about the poppler
mailing list