From 177fa2d5e869cbbf3b950352bb96875d1e00865b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 14 Nov 2016 17:32:46 +0000 Subject: [PATCH] done #917 @1.5 --- inc/ws/Metier/class.ws.document.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 385cb8ac6..842481dd5 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -266,6 +266,8 @@ class wsDocument extends cubeMetier { } } + + return $res; } @@ -371,6 +373,13 @@ class wsDocument extends cubeMetier { $this->addToLog($fwstk); */ } + public function getResolutionRatio(){ + $a4surface = 500990; // en pt² + $docSurface = $this->generalInfos['size'][0] * $this->generalInfos['size'][1]; // en pt² + // to have the same surface resulting in px, we have to sqrt the ratio between the two surfaces defined above + return sqrt($a4surface / $docSurface); + } + public function makeMiniShot($page) { $this->makeShotFixedWidth($page, 'p', 100, 90, 4, 'PNM'); } @@ -467,7 +476,6 @@ class wsDocument extends cubeMetier { $antialiasing = $antialiasing ? 'yes' : 'no'; $freetype = $texts ? 'yes' : 'no'; - $resolution = $resolution; // Exporte les fichiers $pdftoppm = new cubeCommandLine('pdftoppm', null, true); $pdftoppm->setPath(CONVERTER_PATH); @@ -543,7 +551,7 @@ class wsDocument extends cubeMetier { // $method = max($method, self::FLATTEN); } - $out = $this->pdf2swf($page, $resolution, $quality, $storeAllChars, $method, 'p', $version); + $out = $this->pdf2swf($page, $resolution * $this->getResolutionRatio(), $quality, $storeAllChars, $method, 'p', $version); if ($method < self::BARBARE_PNM) { // Analyse de la sortie pour détecter des typos manquantes $overflow = false; @@ -585,9 +593,10 @@ class wsDocument extends cubeMetier { public function makeHTML5Files($page) { // Then make HD background shots $resolutions = array(300 => 85, 150 => 85); + $rratio=$this->getResolutionRatio(); foreach ($resolutions as $r => $q) { - $this->makeShotPNM($page, 'html/h' . $r . '-', $r, $q, 4, null, false); - $this->makeShotPNM($page, 'html/t' . $r . '-', $r, $q, 4, null, true); + $this->makeShotPNM($page, 'html/h' . $r . '-', $r * $rratio, $q, 4, null, false); + $this->makeShotPNM($page, 'html/t' . $r . '-', $r * $rratio, $q, 4, null, true); } $this->makeSVGFile($page); } -- 2.39.5