Commit 7ac7d3ba authored by Adrian Johnson's avatar Adrian Johnson

pdftops: Remove origpagesizes mode and make -origpagesizes an alias for -paper match

Bug 72312
parent 31fc5181
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment