public function extractTexts()
{
- PDFTools::extractTexts($this->getPDFSource(), $this->path(), 'fluidbook', '');
- PDFTools::extractHighlightsData($this->getPDFSource(), $this->path());
+ PDFTools::extractTexts($this->getPDFSource(), $this->path(), 'standard', 'fluidbook', '');
+ PDFTools::extractHighlightsData($this->getPDFSource(), $this->path(), 'standard');
}
public function extractLinks()
/**
* @throws \Exception
*/
- public function getTextFile($page, $type = self::TEXT_PLAIN, $extractionMethod = 'fluidbook', $ignoreSeparators = '')
+ public function getTextFile($page, $type = self::TEXT_PLAIN, $mode = 'standard', $extractionMethod = 'fluidbook', $ignoreSeparators = '')
{
- $path = $this->_getTextPath($page, $type, $extractionMethod, $ignoreSeparators);
+ $path = $this->_getTextPath($page, $type, $mode, $extractionMethod, $ignoreSeparators);
if (!$this->_checkTextFile($path)) {
- PDFTools::extractTexts($this->getPDFSource(), $this->path(), $extractionMethod, $ignoreSeparators);
+ PDFTools::extractTexts($this->getPDFSource(), $this->path(), $mode, $extractionMethod, $ignoreSeparators);
if (!Gzip::file_exists($path)) {
throw new \Exception('An error occured while producing file ' . $path);
}
return Gzip::file_exists($path) && Gzip::filemtime($path) >= FWSTK::lastUpdate();
}
- public function getHightlightFile($page)
+ public function getHightlightFile($page, $mode = 'standard')
{
- $path = $this->_getHightlightFilePath($page);
+ $path = $this->_getHightlightFilePath($page, $mode);
if (!$this->_checkTextFile($path)) {
- PDFTools::extractHighlightsData($this->getPDFSource(), $this->path());
+ PDFTools::extractHighlightsData($this->getPDFSource(), $this->path(), $mode);
if (!Gzip::file_exists($path)) {
throw new \Exception('An error occured while producing file ' . $path);
}
return $map[$textExtraction];
}
- public function _getHightlightFilePath($page)
+ public function _getHightlightFilePath($page, $mode = 'standard')
{
return $this->path('texts/p' . $page . '.fby');
}
- public function _getTextPath($page, $type = self::TEXT_PLAIN, $extractionMethod = 'fluidbook', $ignoreSeparators = '')
+ public function _getTextPath($page, $type = self::TEXT_PLAIN, $mode = 'standard', $extractionMethod = 'fluidbook', $ignoreSeparators = '')
{
$sepFolder = '';
if ($ignoreSeparators) {
public function cutDocument($mode)
{
-
-
$fwstk = new FWSTK();
$fwstk->setArg('--input ' . $this->getPDFSource('fixed'));
$fwstk->setArg('--cut ' . $mode);
public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN)
{
$compo = $this->getComposition()[$page];
- return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $this->textExtraction, $this->ignoreSearchSeparators);
+ return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $this->search_mode ?: 'standard', $this->textExtraction, $this->ignoreSearchSeparators);
}
public function getHightlightFile($page)
{
$compo = $this->getComposition()[$page];
- return self::_getDocument($compo[0])->getHightlightFile($compo[1]);
+ return self::_getDocument($compo[0])->getHightlightFile($compo[1], $this->search_mode ?: 'standard');
}
public function getPDFSplitSource($page)
$page = 1;
}
$document = $this->getDocument($page);
- if(null===$document){
+ if (null === $document) {
return null;
}
return $document->getPageSize($this->getComposition()[$page][1]);