summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2013-12-20 07:19:21 +1030
committerAdrian Johnson <ajohnson@redneon.com>2014-02-05 19:42:50 +1030
commit7ac7d3bad4b868950ee96fd9c5ece88632f8827c (patch)
treef6f9b013806dc2c5b2dc1079bfb84192cfab36c3 /utils
parent31fc5181bc491ff2e4aee0ae05c0f611a36e585c (diff)
pdftops: Remove origpagesizes mode and make -origpagesizes an alias for -paper match
Bug 72312
Diffstat (limited to 'utils')
-rw-r--r--utils/pdftops.130
-rw-r--r--utils/pdftops.cc23
2 files changed, 24 insertions, 29 deletions
diff --git a/utils/pdftops.1 b/utils/pdftops.1
index dd8c84b2..ca26bcc0 100644
--- a/utils/pdftops.1
+++ b/utils/pdftops.1
@@ -65,29 +65,18 @@ CID font embedding.
Generate Level 3 separable PostScript. The separation handling is the
same as for \-level2sep.
.TP
-.B \-origpagesizes
-Generate a PostScript file with variable page sizes and orientations,
-taking for each page the size of the original page in the PDF file.
-The PostScript file contains "<</PageSize [WIDTH HEIGHT]>> setpagedevice"
-lines in each page header, so that the paper input tray gets correctly
-changed on the printer. This option should be used when pdftops is used
-as a print filter. Any specification of the page size via \-paper,
-\-paperw, or \-paperh will get overridden as long as each page of the
-PDF file has a defined paper size. No more than one of the mode options
-(\-origpagesizes, \-eps, \-form) may be given.
-.TP
.B \-eps
Generate an Encapsulated PostScript (EPS) file. An EPS file contains
a single image, so if you use this option with a multi-page PDF file,
you must use \-f and \-l to specify a single page. No more than one of
-the mode options (\-origpagesizes, \-eps, \-form) may be given.
+the mode options (\-eps, \-form) may be given.
.TP
.B \-form
Generate a PostScript form which can be imported by software that
understands forms. A form contains a single page, so if you use this
option with a multi-page PDF file, you must use \-f and \-l to specify a
single page. The \-level1 option cannot be used with \-form. No more
-than one of the mode options (\-origpagesizes, \-eps, \-form) may be
+than one of the mode options (\-eps, \-form) may be
given.
.TP
.B \-opi
@@ -144,17 +133,18 @@ preload images and forms
.TP
.BI \-paper " size"
Set the paper size to one of "letter", "legal", "A4", or "A3". This
-can also be set to "match", which will set the paper size to match the
-size specified in the PDF file. \-origpagesizes overrides this setting
-if the PDF file has defined page sizes.
+can also be set to "match", which will set the paper size of each page to match the
+size specified in the PDF file. If none the \-paper, \-paperw, or \-paperh
+options are spoecified the default is to match the paper size.
.TP
.BI \-paperw " size"
-Set the paper width, in points. \-origpagesizes overrides this setting
-if the PDF file has defined page sizes.
+Set the paper width, in points.
.TP
.BI \-paperh " size"
-Set the paper height, in points. \-origpagesizes overrides this setting
-if the PDF file has defined page sizes.
+Set the paper height, in points.
+.TP
+.B \-origpagesizes
+This option is the same as "\-paper match".
.TP
.B \-nocrop
By default, output is cropped to the CropBox specified in the PDF
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index b54fd425..e003baac 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -81,7 +81,7 @@ static GBool level2 = gFalse;
static GBool level2Sep = gFalse;
static GBool level3 = gFalse;
static GBool level3Sep = gFalse;
-static GBool doOrigPageSizes = gFalse;
+static GBool origPageSizes = gFalse;
static GBool doEPS = gFalse;
static GBool doForm = gFalse;
#if OPI_SUPPORT
@@ -129,7 +129,7 @@ static const ArgDesc argDesc[] = {
"generate Level 3 PostScript"},
{"-level3sep", argFlag, &level3Sep, 0,
"generate Level 3 separable PostScript"},
- {"-origpagesizes",argFlag, &doOrigPageSizes,0,
+ {"-origpagesizes",argFlag, &origPageSizes,0,
"conserve original page sizes"},
{"-eps", argFlag, &doEPS, 0,
"generate Encapsulated PostScript (EPS)"},
@@ -231,10 +231,9 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Error: use only one of the 'level' options.\n");
exit(1);
}
- if ((doOrigPageSizes ? 1 : 0) +
- (doEPS ? 1 : 0) +
+ if ((doEPS ? 1 : 0) +
(doForm ? 1 : 0) > 1) {
- fprintf(stderr, "Error: use only one of -origpagesizes, -eps, and -form\n");
+ fprintf(stderr, "Error: use only one of -eps, and -form\n");
exit(1);
}
if (level1) {
@@ -254,15 +253,21 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Error: forms are only available with Level 2 output.\n");
exit(1);
}
- mode = doOrigPageSizes ? psModePSOrigPageSizes
- : doEPS ? psModeEPS
- : doForm ? psModeForm
- : psModePS;
+ mode = doEPS ? psModeEPS
+ : doForm ? psModeForm
+ : psModePS;
fileName = new GooString(argv[1]);
// read config file
globalParams = new GlobalParams();
+ if (origPageSizes) {
+ paperWidth = paperHeight = -1;
+ }
if (paperSize[0]) {
+ if (origPageSizes) {
+ fprintf(stderr, "Error: -origpagesizes and -paper may not be used together.\n");
+ exit(1);
+ }
if (!setPSPaperSize(paperSize, paperWidth, paperHeight)) {
fprintf(stderr, "Invalid paper size\n");
delete fileName;