From: vincent@cubedesigners.com Date: Mon, 4 Apr 2011 23:45:36 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d2564f1e63ddbbacda3a362df85b70a716a36e1e;p=cubeextranet.git --- diff --git a/inc/prepend.php b/inc/prepend.php index a3f56e883..a2b544c6c 100644 --- a/inc/prepend.php +++ b/inc/prepend.php @@ -1,4 +1,6 @@ complete = true; $this->processing = false; diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index b9cfc2df8..28d5c3eb7 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -30,6 +30,7 @@ class wsDocument extends cubeMetier { // Files protected $out; protected $in; + protected $html; protected $uncompressed; protected $log; protected $common_log_pointer; @@ -59,6 +60,7 @@ class wsDocument extends cubeMetier { { $this->out = WS_DOCS . '/' . $this->document_id . '/'; $this->log = $this->out . '/logs/'; + $this->html = $this->out . '/html/'; $this->in = $this->out . 'original.pdf'; $this->uncompressed = $this->out . 'uncompressed.pdf'; $this->infos = $this->out . 'infos.txt'; @@ -66,6 +68,9 @@ class wsDocument extends cubeMetier { mkdir($this->out, 0755, true); mkdir($this->log, 0755); } + if (!file_exists($this->html)) { + mkdir($this->html, 0755); + } $this->cropped = $this->out . 'crop.pdf'; $this->uncropped = $this->out . 'uncrop.pdf'; $this->common_log_pointer = fopen($this->log . '/commons.log', 'ab'); @@ -132,7 +137,6 @@ class wsDocument extends cubeMetier { $ttf2eot->setPath(CONVERTER_PATH); $ttf2eot->setManualArg('< ' . $this->out . '/fonts/web/' . $fname . '.ttf'); $ttf2eot->execute(); - $this->addToLog($ttf2eot,false); } else { $fontforge = new cubeCommandLine('convert.pe'); $fontforge->setPath(CONVERTER_PATH); @@ -623,11 +627,14 @@ class wsDocument extends cubeMetier { { // First, make swf with polytobitmap to rasterize bitmap & vectors $this->pdf2swf($page, 150, 90, true, self::POLY2BITMAP, 'h'); + // Then get the special unicode dump $dump = $this->dumpSWF($page, 'h'); + // Then, process it $swf2html = new wsSWF2HTML($dump); $swf2html->process(); - $this->addToLog(print_r($swf2html, true), true, $page); + + file_put_contents($this->html . '/p' . $page . '.obj', serialize($swf2html)); } protected function checkObjectsNumber($file, $maxObjects, $page) @@ -647,15 +654,14 @@ class wsDocument extends cubeMetier { protected function dumpSWF($page, $prefix = 'p') { - $swfdump = new cubeCommandLine('swfdump', null, true); + $swfdump = new cubeCommandLine('/usr/local/swftools/special-swfdump/bin/swfdump', null, true); $swfdump->setPath(CONVERTER_PATH); - $swfdump->setLang('en_US.UTF-8'); $swfdump->setArg('t'); $swfdump->setArg('p'); $swfdump->setArg('F'); $swfdump->setArg(null, $this->out . $prefix . $page . '.swf'); $swfdump->execute(); - $this->addToLog($swfdump, true, $page); + $this->addToLog($swfdump, false, $page); return $swfdump->output; } diff --git a/inc/ws/Util/class.ws.swf2html.php b/inc/ws/Util/class.ws.swf2html.php index e97a47d80..f7b67bc82 100644 --- a/inc/ws/Util/class.ws.swf2html.php +++ b/inc/ws/Util/class.ws.swf2html.php @@ -113,22 +113,7 @@ class wsSWF2HTMLFont extends wsSWF2HTMLTag { array_pop($ef); array_pop($ef); $this->name = implode('-', $ef); - } else if (substr($e[0], 0, 2) == '==') { - fb($line); - if (preg_match('|== Glyph \d+: advance=\d+ encoding=(\d+) \'(.*)\' ==|i', $line, $m)) { - $this->addChar($m[1], $m[2]); - } - } - } - - public function addChar($encoding, $char) - { - $e = cubeText::uchr($encoding); - $c = $char; - if ($e == $c) { - return; } - $this->chars[$c] = $e; } } @@ -174,9 +159,7 @@ class wsSWF2HTMLText { public $color; public $font; public $size; - public $origText; public $text; - public $readableText; public $valid = false; public function __construct($line, &$converter) @@ -188,9 +171,7 @@ class wsSWF2HTMLText { $this->color = $matches[3]; $this->x = floatval($matches[4]); $this->y = floatval($matches[5]); - $this->origText=$matches[6]; - $this->text = preg_replace_callback('|\\\\x([0-9a-f]{2})|i', array($this, 'replaceUnicode') , $matches[6]); - $this->readableText = strtr($this->text, $this->converter->fonts[$this->font]->chars); + $this->text = preg_replace_callback('|\\\\x([0-9a-f]+)|i', array($this, 'replaceUnicode') , $matches[6]); $this->valid = true; } else { $this->valid = false; diff --git a/testSWF2HTML.php b/testSWF2HTML.php deleted file mode 100644 index 16b62fc03..000000000 --- a/testSWF2HTML.php +++ /dev/null @@ -1,12 +0,0 @@ -process(); - -echo '
';
-print_r($swf2html);
-echo '
'; -?> \ No newline at end of file