poppler/PSOutputDev.cc | 10 +++++++++- poppler/PSOutputDev.h | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit 5fdc3acb8dded2e7d08e6ef30f4c5ae1a4a11b5e Author: Till Kamppeter <[email protected]> Date: Mon Jun 22 21:38:23 2009 +0200 Only change the page size when it really changes, otherwise duplex commands are lost diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 204894a..6bec12d 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -1308,6 +1308,8 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage, switch (mode) { case psModePSOrigPageSizes: + prevWidth = 0; + prevHeight = 0; case psModePS: writePSFmt("%%DocumentMedia: plain {0:d} {1:d} 0 () ()\n", paperWidth, paperHeight); @@ -3186,7 +3188,13 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) { writePS("%%BeginPageSetup\n"); writePSFmt("%%PageOrientation: {0:s}\n", landscape ? "Landscape" : "Portrait"); - writePSFmt("<</PageSize [{0:d} {1:d}]>> setpagedevice\n", width, height); + if ((width != prevWidth) || (height != prevHeight)) { + // Set page size only when it actually changes, as otherwise Duplex + // printing does not work + writePSFmt("<</PageSize [{0:d} {1:d}]>> setpagedevice\n", width, height); + prevWidth = width; + prevHeight = height; + } writePS("pdfStartPage\n"); writePSFmt("{0:d} {1:d} {2:d} {3:d} re W\n", x1, y1, x2 - x1, y2 - y1); writePS("%%EndPageSetup\n"); diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index 82378a9..6310375 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -352,6 +352,10 @@ private: PSOutMode mode; // PostScript mode (PS, EPS, form) int paperWidth; // width of paper, in pts int paperHeight; // height of paper, in pts + int prevWidth; // width of previous page + // (only psModePSOrigPageSizes output mode) + int prevHeight; // height of previous page + // (only psModePSOrigPageSizes output mode) int imgLLX, imgLLY, // imageable area, in pts imgURX, imgURY; GBool preload; // load all images into memory, and _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
