for ($i = 1; $i <= $this->generalInfos['pages']; $i++) {
$this->processOnePage($i);
}
- //$this->optimizeSVG();
+ $this->optimizeSVG();
}
public function optimizeSVG() {
public function makeSVGFile($page) {
$svgFile = $this->out . '/html/p' . $page . '.svg';
- $svgOpt = $this->out . '/html/o' . $page . '.svg';
$pdftocairo = new cubeCommandLine('pdftocairo');
$pdftocairo->setPath(CONVERTER_PATH);
$pdftocairo->setArg(null, $svgFile);
$pdftocairo->execute();
$this->addToLog($pdftocairo, true, $page);
+ $this->_cleanSVG($svgFile);
+
+ $svgFile = $this->out . '/html/m' . $page . '.svg';
+
+ $mupdf = new CubeIT_CommandLine('mutool');
+ $mupdf->setPath(CONVERTER_PATH);
+ $mupdf->setArg(null, 'draw');
+ $mupdf->setArg('F', 'svg');
+
$this->_cleanSVG($svgFile);
}
$c .= $cl . "\n\n";
}
+ if (!file_exists($this->log)) {
+ mkdir($this->log, 0777, true);
+ }
+
+
if (is_null($page)) {
- $pointer = fopen($this->log . '/commons.log', 'ab');
+ $fname = 'commons.log';
+ } else {
+ $fname = 'p' . $page . '.log';
+ }
+
+ $file = $this->log . '/' . $fname;
+ if (!file_exists($file) && file_exists($fname . '.gz')) {
+ $fopen = 'gzopen';
+ $fwrite = 'gzwrite';
+ $fclose = 'gzclose';
+ $file .= '.gz';
} else {
- $pointer = fopen($this->log . '/p' . $page . '.log', 'ab');
+ $fopen = 'fopen';
+ $fwrite = 'fwrite';
+ $fclose = 'fclose';
}
- fwrite($pointer, $c);
- fclose($pointer);
+ $pointer = $fopen($file, 'ab');
+ $fwrite($pointer, $c);
+ $fclose($pointer);
}
public function __destruct() {