]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 4 Apr 2011 23:45:36 +0000 (23:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 4 Apr 2011 23:45:36 +0000 (23:45 +0000)
inc/prepend.php
inc/ws/Controlleur/class.ws.conversion.session.php
inc/ws/Metier/class.ws.document.php
inc/ws/Util/class.ws.swf2html.php
testSWF2HTML.php [deleted file]

index a3f56e8834585b06f342b11ec0520e0c1d2ae266..a2b544c6c6e63b7beb6514f7d46afab84dd347f6 100644 (file)
@@ -1,4 +1,6 @@
 <?php\r
+ini_set('error_log', dirname(__FILE__).'/../../logs/error_php');\r
+\r
 // Inclusion du fichier de configuration\r
 require_once(dirname(__FILE__) . '/config.inc.php');\r
 // Chargement de la classe cube\r
index 8662d1b51e5449db906ca6ef81e152ae83f818eb..e03c2c864ce0d19774a1965119583701b7e0f7aa 100644 (file)
@@ -144,7 +144,7 @@ class wsConversionSession {
                        ob_flush();\r
                }\r
 \r
-               sleep(1);\r
+               usleep(100000);\r
 \r
                $this->complete = true;\r
                $this->processing = false;\r
index b9cfc2df86ad5bddd440a5b03e42d90d40a8dac5..28d5c3eb7490f29c557420bab9c1dc54caf42572 100644 (file)
@@ -30,6 +30,7 @@ class wsDocument extends cubeMetier {
        // Files\r
        protected $out;\r
        protected $in;\r
+       protected $html;\r
        protected $uncompressed;\r
        protected $log;\r
        protected $common_log_pointer;\r
@@ -59,6 +60,7 @@ class wsDocument extends cubeMetier {
        {\r
                $this->out = WS_DOCS . '/' . $this->document_id . '/';\r
                $this->log = $this->out . '/logs/';\r
+               $this->html = $this->out . '/html/';\r
                $this->in = $this->out . 'original.pdf';\r
                $this->uncompressed = $this->out . 'uncompressed.pdf';\r
                $this->infos = $this->out . 'infos.txt';\r
@@ -66,6 +68,9 @@ class wsDocument extends cubeMetier {
                        mkdir($this->out, 0755, true);\r
                        mkdir($this->log, 0755);\r
                }\r
+               if (!file_exists($this->html)) {\r
+                       mkdir($this->html, 0755);\r
+               }\r
                $this->cropped = $this->out . 'crop.pdf';\r
                $this->uncropped = $this->out . 'uncrop.pdf';\r
                $this->common_log_pointer = fopen($this->log . '/commons.log', 'ab');\r
@@ -132,7 +137,6 @@ class wsDocument extends cubeMetier {
                                        $ttf2eot->setPath(CONVERTER_PATH);\r
                                        $ttf2eot->setManualArg('< ' . $this->out . '/fonts/web/' . $fname . '.ttf');\r
                                        $ttf2eot->execute();\r
-                                       $this->addToLog($ttf2eot,false);\r
                                } else {\r
                                        $fontforge = new cubeCommandLine('convert.pe');\r
                                        $fontforge->setPath(CONVERTER_PATH);\r
@@ -623,11 +627,14 @@ class wsDocument extends cubeMetier {
        {\r
                // First, make swf with polytobitmap to rasterize bitmap & vectors\r
                $this->pdf2swf($page, 150, 90, true, self::POLY2BITMAP, 'h');\r
+               // Then get the special unicode dump\r
                $dump = $this->dumpSWF($page, 'h');\r
+               // Then, process it\r
                $swf2html = new wsSWF2HTML($dump);\r
                $swf2html->process();\r
-\r
                $this->addToLog(print_r($swf2html, true), true, $page);\r
+\r
+               file_put_contents($this->html . '/p' . $page . '.obj', serialize($swf2html));\r
        }\r
 \r
        protected function checkObjectsNumber($file, $maxObjects, $page)\r
@@ -647,15 +654,14 @@ class wsDocument extends cubeMetier {
 \r
        protected function dumpSWF($page, $prefix = 'p')\r
        {\r
-               $swfdump = new cubeCommandLine('swfdump', null, true);\r
+               $swfdump = new cubeCommandLine('/usr/local/swftools/special-swfdump/bin/swfdump', null, true);\r
                $swfdump->setPath(CONVERTER_PATH);\r
-               $swfdump->setLang('en_US.UTF-8');\r
                $swfdump->setArg('t');\r
                $swfdump->setArg('p');\r
                $swfdump->setArg('F');\r
                $swfdump->setArg(null, $this->out . $prefix . $page . '.swf');\r
                $swfdump->execute();\r
-               $this->addToLog($swfdump, true, $page);\r
+               $this->addToLog($swfdump, false, $page);\r
                return $swfdump->output;\r
        }\r
 \r
index e97a47d803b650108c84c2902f649fb407a303ec..f7b67bc82b007592bf4e94c41d150e74513d6a42 100644 (file)
@@ -113,22 +113,7 @@ class wsSWF2HTMLFont extends wsSWF2HTMLTag {
                        array_pop($ef);\r
                        array_pop($ef);\r
                        $this->name = implode('-', $ef);\r
-               } else if (substr($e[0], 0, 2) == '==') {\r
-               fb($line);\r
-                       if (preg_match('|== Glyph \d+: advance=\d+ encoding=(\d+) \'(.*)\' ==|i', $line, $m)) {\r
-                               $this->addChar($m[1], $m[2]);\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function addChar($encoding, $char)\r
-       {\r
-               $e = cubeText::uchr($encoding);\r
-               $c = $char;\r
-               if ($e == $c) {\r
-                       return;\r
                }\r
-               $this->chars[$c] = $e;\r
        }\r
 }\r
 \r
@@ -174,9 +159,7 @@ class wsSWF2HTMLText {
        public $color;\r
        public $font;\r
        public $size;\r
-       public $origText;\r
        public $text;\r
-       public $readableText;\r
 \r
        public $valid = false;\r
        public function __construct($line, &$converter)\r
@@ -188,9 +171,7 @@ class wsSWF2HTMLText {
                        $this->color = $matches[3];\r
                        $this->x = floatval($matches[4]);\r
                        $this->y = floatval($matches[5]);\r
-                       $this->origText=$matches[6];\r
-                       $this->text = preg_replace_callback('|\\\\x([0-9a-f]{2})|i', array($this, 'replaceUnicode') , $matches[6]);\r
-                       $this->readableText = strtr($this->text, $this->converter->fonts[$this->font]->chars);\r
+                       $this->text = preg_replace_callback('|\\\\x([0-9a-f]+)|i', array($this, 'replaceUnicode') , $matches[6]);\r
                        $this->valid = true;\r
                } else {\r
                        $this->valid = false;\r
diff --git a/testSWF2HTML.php b/testSWF2HTML.php
deleted file mode 100644 (file)
index 16b62fc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php\r
-require_once(dirname(__FILE__) . '/inc/cube/_common.php');\r
-require_once(dirname(__FILE__) . '/inc/ws/Util/_common.php');\r
-\r
-\r
-$swf2html = new wsSWF2HTML(file_get_contents(dirname(__FILE__) . '/cache/dump.txt'));\r
-$swf2html->process();\r
-\r
-echo '<pre>';\r
-print_r($swf2html);\r
-echo '</pre>';\r
-?>
\ No newline at end of file