From 4a6bb768c84dbb5081532929a41fa971f4cf9d7a Mon Sep 17 00:00:00 2001 From: vog Date: Fri, 14 Sep 2012 16:06:29 +0000 Subject: [PATCH] Issue #847: Split recognition of implicit Page, BeginPageSetup and EndPageSetup --- src/epsimage.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/epsimage.cpp b/src/epsimage.cpp index 9276eb56..57051a1a 100644 --- a/src/epsimage.cpp +++ b/src/epsimage.cpp @@ -396,6 +396,7 @@ namespace { bool illustrator8 = false; bool corelDraw = false; bool implicitPage = false; + bool implicitPageSetup = false; bool implicitPageTrailer = false; bool inDefaultsPreviewPrologSetup = false; bool inRemovableEmbedding = false; @@ -510,29 +511,35 @@ namespace { if (posPage == posEndEps && posEndComments != posEndEps && !inDefaultsPreviewPrologSetup && !inRemovableEmbedding && !onlyWhitespaces(line)) { posPage = startPos; implicitPage = true; - posBeginPageSetup = startPos; - posEndPageSetup = startPos; #ifdef DEBUG - EXV_DEBUG << "readWriteEpsMetadata: Found implicit Page, BeginPageSetup and EndPageSetup at position: " << startPos << "\n"; + EXV_DEBUG << "readWriteEpsMetadata: Found implicit Page at position: " << startPos << "\n"; #endif } - if (posBeginPageSetup == posEndEps && posPage != posEndEps && !inRemovableEmbedding && line.size() >= 1 && line[0] != '%') { + if (posBeginPageSetup == posEndEps && (implicitPage || (posPage != posEndEps && !inRemovableEmbedding && line.size() >= 1 && line[0] != '%'))) { posBeginPageSetup = startPos; + implicitPageSetup = true; + #ifdef DEBUG + EXV_DEBUG << "readWriteEpsMetadata: Found implicit BeginPageSetup at position: " << startPos << "\n"; + #endif + } + if (posEndPageSetup == posEndEps && implicitPageSetup) { posEndPageSetup = startPos; #ifdef DEBUG - EXV_DEBUG << "readWriteEpsMetadata: Found implicit BeginPageSetup and EndPageSetup at position: " << startPos << "\n"; + EXV_DEBUG << "readWriteEpsMetadata: Found implicit EndPageSetup at position: " << startPos << "\n"; #endif } if (line.size() >= 1 && line[0] != '%') continue; // performance optimization if (line == "%%EOF" || line == "%%Trailer" || line == "%%PageTrailer") { if (posBeginPageSetup == posEndEps) { posBeginPageSetup = startPos; + implicitPageSetup = true; #ifdef DEBUG EXV_DEBUG << "readWriteEpsMetadata: Found implicit BeginPageSetup at position: " << startPos << "\n"; #endif } if (posEndPageSetup == posEndEps) { posEndPageSetup = startPos; + implicitPageSetup = true; #ifdef DEBUG EXV_DEBUG << "readWriteEpsMetadata: Found implicit EndPageSetup at position: " << startPos << "\n"; #endif