silverstripe-textextraction/docs/en/developer-docs.md
2018-07-03 17:03:19 +12:00

660 B

Developer documentation

Usage

Manual extraction via string file path:

$myFile = '/my/path/myfile.pdf';
$extractor = FileTextExtractor::for_file($myFile);
$content = $extractor->getContent($myFile);

Manual extraction via File object:

$myFile = File::get()->filter(['Name' => 'My file')->first();
$extractor = FileTextExtractor::for_file($myFile);
$content = $extractor->getContent($myFile);

Extraction with FileTextExtractable extension applied:

$myFileObj = File::get()->First();
$content = $myFileObj->getFileContent();

This content can also be embedded directly within a template.

$MyFile.FileContent