Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
 (new Parser)->parseFile($path)->getText(), 'docx', 'doc' => $this->extractWord($path), 'txt', 'csv' => file_get_contents($path), default => null, }; return $text ? mb_substr(trim(preg_replace('/\s+/', ' ', $text)), 0, 50000) : null; } catch (Throwable) { return null; } } private function extractWord(string $path): string { $document = IOFactory::load($path); $text = []; foreach ($document->getSections() as $section) { foreach ($section->getElements() as $element) { if (method_exists($element, 'getText')) { $value = $element->getText(); $text[] = is_string($value) ? $value : ''; } } } return implode("\n", $text); } }