From 5c6051c007dedbf242c48016b4ed99705ff185fa Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 20 Dec 2013 07:16:37 +1030 Subject: [PATCH 3/5] pdftops: Use crop box as page size unless -nocrop is used. The fontends use the crop box as the page size and acroread uses the cropbox as the page size for display and printing. Bug 72312 --- poppler/PSOutputDev.cc | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 1329504..abc2658 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -3571,8 +3571,13 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { if (paperMatch) { page = doc->getCatalog()->getPage(pageNum); imgLLX = imgLLY = 0; - imgURX = (int)ceil(page->getMediaWidth()); - imgURY = (int)ceil(page->getMediaHeight()); + if (noCrop) { + imgURX = (int)ceil(page->getMediaWidth()); + imgURY = (int)ceil(page->getMediaHeight()); + } else { + imgURX = (int)ceil(page->getCropWidth()); + imgURY = (int)ceil(page->getCropHeight()); + } if (state->getRotate() == 90 || state->getRotate() == 270) { t = imgURX; imgURX = imgURY; @@ -3645,25 +3650,6 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { writePS("%%BeginPageSetup\n"); if (paperMatch) { writePSFmt("{0:d} {1:d} pdfSetupPaper\n", imgURX, imgURY); - if (mode == psModePSOrigPageSizes) { - // Set page size only when it actually changes, as otherwise Duplex - // printing does not work - if (rotate == 0 || rotate == 180) { - if ((width != prevWidth) || (height != prevHeight)) { - writePSFmt("<> setpagedevice\n", - width, height); - prevWidth = width; - prevHeight = height; - } - } else { - if ((height != prevWidth) || (width != prevHeight)) { - writePSFmt("<> setpagedevice\n", - height, width); - prevWidth = height; - prevHeight = width; - } - } - } } writePS("pdfStartPage\n"); if (rotate == 0) { -- 1.8.3.2