]> _ Git - cubeextranet.git/commitdiff
done #917 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 14 Nov 2016 17:32:46 +0000 (17:32 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 14 Nov 2016 17:32:46 +0000 (17:32 +0000)
inc/ws/Metier/class.ws.document.php

index 385cb8ac69a7c066232425925891d64b995facd8..842481dd5c940c39536d69e594106c1a19c748ba 100644 (file)
@@ -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);
        }