summaryrefslogtreecommitdiff
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
parent31fc5181bc491ff2e4aee0ae05c0f611a36e585c (diff)
pdftops: Remove origpagesizes mode and make -origpagesizes an alias for -paper match
Bug 72312
-rw-r--r--poppler/PSOutputDev.cc9
-rw-r--r--poppler/PSOutputDev.h4
-rw-r--r--utils/pdftops.130
-rw-r--r--utils/pdftops.cc23
4 files changed, 28 insertions, 38 deletions
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 9ebb5a0e..f1e501d6 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1216,6 +1216,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
mode = modeA;
paperWidth = paperWidthA;
paperHeight = paperHeightA;
+ noCrop = noCropA;
imgLLX = imgLLXA;
imgLLY = imgLLYA;
imgURX = imgURXA;
@@ -1443,7 +1444,6 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage,
int i;
switch (mode) {
- case psModePSOrigPageSizes:
case psModePS:
writePS("%!PS-Adobe-3.0\n");
break;
@@ -1485,10 +1485,6 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage,
}
switch (mode) {
- case psModePSOrigPageSizes:
- paperMatch = gTrue;
- prevWidth = 0;
- prevHeight = 0;
case psModePS:
for (i = 0; i < paperSizes->getLength(); ++i) {
size = (PSOutPaperSize *)paperSizes->get(i);
@@ -3557,7 +3553,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
PSOutPaperSize *paperSize;
xref = xrefA;
- if (mode == psModePS || mode == psModePSOrigPageSizes) {
+ if (mode == psModePS) {
GooString pageLabel;
const GBool gotLabel = doc->getCatalog()->indexToLabel(pageNum -1, &pageLabel);
if (gotLabel) {
@@ -3602,7 +3598,6 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
xScale = yScale = 1;
switch (mode) {
- case psModePSOrigPageSizes:
case psModePS:
// rotate, translate, and scale page
imgWidth = imgURX - imgLLX;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index f14f03fb..c654d2e6 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -68,8 +68,7 @@ class PSOutputDev;
enum PSOutMode {
psModePS,
psModeEPS,
- psModeForm,
- psModePSOrigPageSizes
+ psModeForm
};
enum PSFileType {
@@ -411,6 +410,7 @@ private:
imgURX, imgURY;
GBool preload; // load all images into memory, and
// predefine forms
+ GBool noCrop;
PSOutputFunc outputFunc;
void *outputStream;
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;