mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
24 lines
433 B
Markdown
24 lines
433 B
Markdown
|
# Developer documentation
|
||
|
## Usage
|
||
|
|
||
|
Manual extraction:
|
||
|
|
||
|
```php
|
||
|
$myFile = '/my/path/myfile.pdf';
|
||
|
$extractor = FileTextExtractor::for_file($myFile);
|
||
|
$content = $extractor->getContent($myFile);
|
||
|
```
|
||
|
|
||
|
Extraction with `FileTextExtractable` extension applied:
|
||
|
|
||
|
```php
|
||
|
$myFileObj = File::get()->First();
|
||
|
$content = $myFileObj->getFileContent();
|
||
|
```
|
||
|
|
||
|
This content can also be embedded directly within a template.
|
||
|
|
||
|
```
|
||
|
$MyFile.FileContent
|
||
|
```
|