From 3fad2e7de58135459df1656e32bab1a01dc0a677 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 15 Dec 2013 18:06:41 +1030 Subject: [PATCH 3/3] pdftops: don't centre page within mediaBox when using cropBox as page size Based on Till Kamppeter's patch but corrected to handle the no crop option. Bug 72312 --- poppler/PSOutputDev.cc | 3 ++- poppler/PSOutputDev.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 85f2b93..ef5e7bf 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; @@ -3726,7 +3727,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { if (tx0 >= 0 && ty0 >= 0) { tx += (rotate == 0 || rotate == 180) ? tx0 : ty0; ty += (rotate == 0 || rotate == 180) ? ty0 : -tx0; - } else if (globalParams->getPSCenter()) { + } else if (!noCrop && mode != psModePSOrigPageSizes && globalParams->getPSCenter()) { if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) { tx += (imgWidth2 - xScale * (clipURX0 - clipLLX0)) / 2; ty += (imgHeight2 - yScale * (clipURY0 - clipLLY0)) / 2; diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index f14f03f..fe8b57a 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -411,6 +411,7 @@ private: imgURX, imgURY; GBool preload; // load all images into memory, and // predefine forms + GBool noCrop; PSOutputFunc outputFunc; void *outputStream; -- 1.8.3.2