diff --git a/app/Ingest/DocumentHandler.php b/app/Ingest/DocumentHandler.php index dbf9ab9..0fe2893 100644 --- a/app/Ingest/DocumentHandler.php +++ b/app/Ingest/DocumentHandler.php @@ -56,9 +56,9 @@ class DocumentHandler $type = $this->supportedFiles[$this->mimeType]; - $id = str_replace(' ', '_', $this->id); + // $id = str_replace(' ', '_', $this->id); - $path = $storage->putFileAs("contracts/$id", $this->document, "document.$type"); + $path = $storage->putFileAs("contracts/{$this->id}", $this->document, "document.$type"); IngestDocuments::dispatch( $this->id, diff --git a/app/Ingest/PDFConvertor.php b/app/Ingest/PDFConvertor.php index 36af542..17a3725 100644 --- a/app/Ingest/PDFConvertor.php +++ b/app/Ingest/PDFConvertor.php @@ -190,7 +190,7 @@ class PDFConvertor extends AbstractConvertor $src = './contracts-images/' . pathinfo($this->directoryPath, PATHINFO_BASENAME) . '/' . pathinfo($p['src'], PATHINFO_BASENAME); $html = $html . '
'; - $html = $html . '' . $caption . ''; + $html = $html . '' . $caption . ''; $html = $html . '
'; $html = $html . '
'; @@ -201,26 +201,13 @@ class PDFConvertor extends AbstractConvertor { $id = (int) $p['font']; $font_size = $fonts[$id]['size']; - $font_color = $fonts[$id]['color']; - $font_family = $fonts[$id]['family']; - - $style = ''; - $style = $style . 'position: relative;'; - $style = $style . "color: $font_color;"; - $style = $style . "font-family: $font_family;"; - $style = $style . "font-weight: 900;"; - $style = $style . "width: " . $p['width'] . "px;"; - $style = $style . "height: " . $p['height'] . "px;"; - $style = $style . "top: " . $p['top'] . "px;"; - $style = $style . "left: " . $p['left'] . "px;"; - $style = $style . "font-size: $font_size" . "px;"; if ($p->i) { $content = '' . $p->i . ''; } else if ($p->b) { $content = '' . $p->b . ''; } else if ($p->a) { - $content = $p . '' . $p->a . ''; + $content = $p . '' . $p->a . ''; } else { $content = $p; } @@ -231,7 +218,7 @@ class PDFConvertor extends AbstractConvertor $tag = $this->getTag($font_size); - return '<' . $tag . ' style="' . $style . '">' . $content . ''; + return '<' . $tag . '>' . $content . ''; } protected function getTag($size) @@ -250,7 +237,7 @@ class PDFConvertor extends AbstractConvertor return 'h3'; } - return 'p'; + return 'span'; } protected function applyOCR($path) @@ -278,11 +265,12 @@ class PDFConvertor extends AbstractConvertor $process->run(); - if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } - + + unlink($filepath . '/document.html'); + return $process->getOutput(); }