protected $guid;\r
protected $progress = 0;\r
protected $processing = false;\r
- protected $inited=false;\r
+ protected $inited = false;\r
protected $complete = false;\r
protected $totalPages = null;\r
+ protected $currentDoc = null;\r
+ protected $currentDocPage = 0;\r
+ protected $totalDocPage = 0;\r
+ protected $totalDoc = 0;\r
protected $processedPages = 0;\r
+ protected $processedDoc = 0;\r
\r
public function __construct($guid)\r
{\r
foreach($this->documents as $doc) {\r
$this->totalPages += $doc->getPagesNumber();\r
}\r
- $inited=true;\r
+ $this->totalDoc = count($this->documents);\r
+ $inited = true;\r
}\r
\r
public function process()\r
$this->serialize();\r
\r
foreach($this->documents as $doc) {\r
+ $this->currentDoc = $doc;\r
for($i = 1;$i <= $doc->generalInfos['pages'];$i++) {\r
+ $this->currentDocPage = $i;\r
+ $this->totalDocPage = $doc->generalInfos['pages'];\r
+ $this->setProgress(($this->processedPages / $this->totalPages) * 100);\r
$doc->processOnePage($i);\r
$this->processedPages++;\r
- $this->setProgress(($this->processedPages / $this->totalPages) * 100);\r
}\r
+ $this->processedDoc++;\r
}\r
\r
$this->complete = true;\r
\r
public function getProgress()\r
{\r
- return $this->progress;\r
+ return array("progress" => $this->progress,\r
+ 'currentDoc' => $this->currentDoc->file,\r
+ 'totalDoc' => $this->totalDoc,\r
+ 'currentDocPage' => $this->currentDocPage,\r
+ 'totalDocPage' => $this->totalDocPage,\r
+ 'totalPages' => $this->totalPages,\r
+ 'processedPages' => $this->processedPages,\r
+ 'processedDoc' => max($this->processedDoc + 1, $this->totalDoc));\r
}\r
\r
public function setProgress($i)\r
\r
public function __destruct()\r
{\r
- //$this->serialize();\r
+ // $this->serialize();\r
}\r
\r
public static function openFromGUID($guid)\r
$data = array();\r
$data['proprietaire'] = $core->user->utilisateur_id;\r
$data['pages'] = 0;\r
- $data['file'] = $infos['name'];\r
+ $data['file'] = cubeFiles::tidyName($infos['name']);\r
$li = new wsDocumentLocalInfos();\r
$li->fileName = $this->args['fileName'];\r
$li->fileSize = $this->args['fileSize'];\r
{\r
set_time_limit(1);\r
$session = wsConversionSession::openFromGUID($_SESSION['sessionConversionGUID']);\r
- $this->xml->addChild('progress', $session->getProgress());\r
- $this->xml->addChild('totalPages',$session->getTotalPages());\r
- $this->xml->addChild('processedPages',$session->getProcessedPages());\r
+ $p = $session->getProgress();\r
+ $this->xml->addChild('progress', $p['progress']);\r
+ $this->xml->addChild('processedDoc', $p['processedDoc']);\r
+ $this->xml->addChild('totalDoc', $p['totalDoc']);\r
+ $this->xml->addChild('currentDoc', $p['currentDoc']);\r
+ $this->xml->addChild('currentDocPage', $p['currentDocPage']);\r
+ $this->xml->addChild('totalDocPage', $p['totalDocPage']);\r
}\r
}\r
\r
const FLATTEN = 1;\r
const POLY2BITMAP = 2;\r
const BITMAP = 3;\r
- const BARBARE = 4;\r
+ const BARBARE_PNM = 4;\r
+ const BARBARE_GS = 5;\r
\r
public function init()\r
{\r
}\r
\r
$out = $this->pdf2swf($page, $resolution, $quality, $storeAllChars, $method, $multiply);\r
- if ($method < self::BARBARE) {\r
+ if ($method < self::BARBARE_PNM) {\r
// Analyse de la sortie pour détecter des typos manquantes\r
$overflow = false;\r
$overflowObjects = false;\r
unlink($this->out . 'p' . $page . '.swf');\r
}\r
\r
- if ($method < self::BARBARE) {\r
+ if ($method < self::BARBARE_PNM) {\r
$resolution2multiply = array(72 => 2, 100 => 2, 150 => 3, 200 => 3, 300 => 3, 450 => 4, 600 => 5);\r
\r
$pdf2swf = new cubeCommandLine('pdf2swf', null, true);\r
$this->addToLog($pdf2swf, true);\r
return array('outputfile' => $pdf2swf->outputfile, 'multiply' => $multiply, 'object' => $pdf2swf);\r
} else {\r
- return array('outputfile' => $this->pdf2swfBarbare($page, $resolution, $quality), 'multiply' => 1);\r
+ return array('outputfile' => $this->pdf2swfBarbare($page, $resolution, $quality, $method), 'multiply' => 1);\r
}\r
}\r
\r
$this->addToLog($swfcombine);\r
}\r
\r
- protected function pdf2swfBarbare($page = null, $resolution = 150, $quality = 85)\r
+ protected function pdf2swfBarbare($page = null, $resolution = 150, $quality = 85, $method = 4)\r
{\r
// Fabrique les images\r
- $this->makeShot($page, 'barbare', $resolution, $quality, 4, 'PNM');\r
+ if ($method == BARBARE_PNM) {\r
+ $this->makeShot($page, 'barbare', $resolution, $quality, 4, 'PNM');\r
+ } elseif ($method == BARBARE_GS) {\r
+ $this->makeShot($page, 'barbare', $resolution, $quality, 4, 'GS');\r
+ }\r
// A partir des images, on crée les swf\r
if (is_null($page)) {\r
$startpage = 1;\r