From 3221362527bad1c9328a2c2eb8e9f071267969b7 Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Wed, 5 Dec 2018 16:38:11 +0000 Subject: [PATCH] Merge print improvements into master branch. Done #817 @2 --- .../html5/master/class.ws.html5.compiler.php | 1 + .../printing/class.ws.html5.compiler.php | 47 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index bd43ced8d..171c6a8c9 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -77,6 +77,7 @@ class wsHTML5Compiler 'js/libs/fluidbook/menu/fluidbook.index.js', 'js/libs/fluidbook/fluidbook.landingpage.js', 'js/libs/fluidbook/fluidbook.slideshow.js', + 'js/libs/fluidbook/fluidbook.print.js', 'js/libs/fluidbook/fluidbook.js', 'js/main.js'] ]; diff --git a/inc/ws/Util/html5/printing/class.ws.html5.compiler.php b/inc/ws/Util/html5/printing/class.ws.html5.compiler.php index e0b7bf317..171c6a8c9 100644 --- a/inc/ws/Util/html5/printing/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/printing/class.ws.html5.compiler.php @@ -1423,6 +1423,27 @@ class wsHTML5Compiler $thisimagesvg = !$thisrasterize && $this->svg; $thisbackgroundPrefix = $thisrasterize ? ['t'] : $this->backgroundsPrefix; + foreach ($this->getResolutions() as $r) { + foreach ($thisbackgroundPrefix as $backgroundsPrefix) { + $srcPrefix = $backgroundsPrefix; + if ($backgroundsPrefix == 'p') { + $srcPrefix = 'h'; + } + $source = $docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg'; + if (!file_exists($source)) { + if (!isset($doc) || $doc->document_id != $infos['document_id']) { + $dao = new wsDAODocument($core->con); + $doc = $dao->selectById($infos['document_id']); + } + $doc->makeHTML5Files($infos['document_page']); + } + $ok = $this->vdir->copy($source, 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg'); + if (!$ok && $r = 300) { + $this->maxRes = 150; + } + } + } + if ($thisimagesvg) { $full = $docdir . 'html/fp' . $infos['document_page'] . '.svg'; $fullopt = $docdir . 'html/fo' . $infos['document_page'] . '%s.svg'; @@ -1447,18 +1468,6 @@ class wsHTML5Compiler } } - foreach ($this->getResolutions() as $r) { - foreach ($thisbackgroundPrefix as $backgroundsPrefix) { - $srcPrefix = $backgroundsPrefix; - if ($backgroundsPrefix == 'p') { - $srcPrefix = 'h'; - } - $ok = $this->vdir->copy($docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg'); - if (!$ok && $r = 300) { - $this->maxRes = 150; - } - } - } $thumb = false; if ($this->book->parametres->pdfThumbnails) { @@ -1599,9 +1608,17 @@ class wsHTML5Compiler $res[] = '.doublePage._2d.axis_y.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}'; $res[] = '.doublePage._2d.axis_y.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}'; - $res[] = '.doublePage._3d{left:' . $w . ';}'; - $res[] = '#links.right{left:-' . $w . ';}'; - $res[] = '.landscape .page.right{left:' . $w . '}'; + + $left = $w; + if ($this->book->parametres->correctCenter) { + $centerOffset = 3; + $left = ($cssWidth - $centerOffset) . 'px'; + $res[] = '.doublePage._3d .page.left{left:-' . ($centerOffset + 1) . 'px !important;}'; + } + + $res[] = '.doublePage._3d{left:' . $left . ';}'; + $res[] = '#links.right{left:-' . $left . ';}'; + $res[] = '.landscape .page.right{left:' . $left . '}'; $lessVariables['page-number-color'] = wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber); $lessVariables['display-page-number'] = $this->_lessBoolean($this->theme->parametres->displayPageNumber); -- 2.39.5