2015-11-06 23:50:19 +01:00
|
|
|
# Developer documentation
|
2018-07-03 07:03:19 +02:00
|
|
|
|
2015-11-06 23:50:19 +01:00
|
|
|
## Usage
|
|
|
|
|
2018-07-03 07:03:19 +02:00
|
|
|
Manual extraction via string file path:
|
2015-11-06 23:50:19 +01:00
|
|
|
|
|
|
|
```php
|
|
|
|
$myFile = '/my/path/myfile.pdf';
|
|
|
|
$extractor = FileTextExtractor::for_file($myFile);
|
|
|
|
$content = $extractor->getContent($myFile);
|
|
|
|
```
|
|
|
|
|
2018-07-03 07:03:19 +02:00
|
|
|
Manual extraction via File object:
|
|
|
|
|
|
|
|
```php
|
|
|
|
$myFile = File::get()->filter(['Name' => 'My file')->first();
|
|
|
|
$extractor = FileTextExtractor::for_file($myFile);
|
|
|
|
$content = $extractor->getContent($myFile);
|
|
|
|
```
|
|
|
|
|
2015-11-06 23:50:19 +01:00
|
|
|
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
|
|
|
|
```
|