From: vincent@cubedesigners.com Date: Thu, 4 Mar 2010 08:59:57 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ecce5c05781543a36701399ce992244810492638;p=cubeextranet.git --- diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 34b2e6230..0f7281919 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -75,8 +75,8 @@ class wsDocument extends cubeMetier { public function getInfos($in = null, $force = false) { - if(is_null($in)){ - $in=$this->in; + if (is_null($in)) { + $in = $this->in; } $fwstk = new cubeCommandLine('fwstk'); @@ -213,14 +213,18 @@ class wsDocument extends cubeMetier { public function globalOperations() { $this->getInfos(); - $this->CropAndCut(); - $this->getInfos($this->cropped, true); - $this->getLinks(); - $this->getTexts(); + if ($this->CropAndCut()) { + $this->getInfos($this->cropped, true); + } + $this->getLinksAndTexts(); } public function CropAndCut() { + if (!$this->isCropped()) { + copy($this->in, $this->cropped); + return false; + } if ($this->autocrop == 'trim') { $this->trimDocument(); } else { @@ -229,7 +233,9 @@ class wsDocument extends cubeMetier { if ($this->autocut) { $this->cutDocument($this->autocut); + return true; } + return false; } public function cutDocument($mode) @@ -289,9 +295,17 @@ class wsDocument extends cubeMetier { } } - public function getTexts() + public function getLinksAndTexts() { - $temp = cubeFiles::tempnam(); + $fwstk = new cubeCommandLine('fwstk'); + $fwstk->setPath(CONVERTER_PATH); + $fwstk->setArg('--input ' . $this->cropped); + $fwstk->setArg('--extractTexts ' . $this->out . 'p%d.txt'); + $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv'); + $fwstk->execute(); + $this->addToLog($fwstk); + + /*$temp = cubeFiles::tempnam(); $pdftotext = new cubeCommandLine('pdftotext', null, true); $pdftotext->setPath(CONVERTER_PATH); $pdftotext->setArg('q'); @@ -312,7 +326,7 @@ class wsDocument extends cubeMetier { file_put_contents($this->out . 'p' . $i . '.txt', $txt); } - unlink($temp); + unlink($temp);*/ } public function makeMiniShot($page) @@ -672,16 +686,6 @@ disablelinks Disable links. $this->addToLog($swfcombine); } - protected function getLinks() - { - $fwstk = new cubeCommandLine('fwstk'); - $fwstk->setPath(CONVERTER_PATH); - $fwstk->setArg('--input ' . $this->cropped); - $fwstk->setArg('--extractLinks ' . $this->out . 'p%d.csv'); - $fwstk->execute(); - $this->addToLog($fwstk); - } - protected function pdf2swfBarbare($page, $resolution = 150, $quality = 85, $method = 4) { // Fabrique les images