xatham/text-extraction
Composer 安装命令:
composer require xatham/text-extraction
包简介
Easy text extraction for many different file types
README 文档
README
text-extraction
About
This PHP-Library let's you extract plain text from various document types.
Currently supported file mime-types for extraction are:
text/plain
text/csv
application/vnd.ms-excel
application/vnd.oasis.opendocument.text
application/pdf
application/msword'
Install
composer require xatham/text-extraction
Usage
/** * Extracting only pdf files, without ocr capturing */ $textExtractor = (new TextExtractionBuilder())->buildTextExtractor( [ 'withOcr' => false, 'validMimeTypes' => ['application/pdf'], ], ); $target = dirname(__DIR__) . '/examples/sample.pdf'; $plainTextDocument = $textExtractor->extractByFilePath($target); if ($plainTextDocument === null) { exit('Could not extract any data'); } $texts = $plainTextDocument->getTextItems(); foreach ($texts as $text) { var_dump($text); }
License
text-extraction is licensed under MIT.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-19