// Files\r
protected $out;\r
protected $in;\r
+ protected $html;\r
protected $uncompressed;\r
protected $log;\r
protected $common_log_pointer;\r
{\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
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
$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
{\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
\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
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
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
$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