Skip to content

Commit

Permalink
Merge pull request #7 from videni/master
Browse files Browse the repository at this point in the history
make pdtToText work
  • Loading branch information
ncjoes committed Nov 23, 2018
2 parents 27f912c + a0df681 commit a9ea2de
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions src/PopplerPhp/PdfToText.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,73 @@

namespace NcJoes\PopplerPhp;

use NcJoes\PopplerPhp\Constants as C;

class PdfToText extends PopplerUtil
{
/**
* PdfToCairo constructor.
*
* @param string $pdfFile
* @param array $options
*/
public function __construct($pdfFile = '', array $options = [])
{
$this->bin_file = C::PDF_TO_TEXT;

return parent::__construct($pdfFile, $options);
}

public function utilOptions()
{
// TODO: Implement utilOptions() method.
return $this->pageRangeOptions();
}

public function utilOptionRules()
{
// TODO: Implement utilOptionRules() method.
return [];
}

public function utilFlags()
{
// TODO: Implement utilFlags() method.
return [];
}

public function utilFlagRules()
{
// TODO: Implement utilFlagRules() method.
return [];
}

public function outputExtension()
{
return '.txt';
}
}

/**
* @return string
*/
public function generate()
{
$this->output_file_extension = $this->outputExtension();

return $this->shellExec();
}

public function startFromPage($page)
{
return $this->setOption(C::_F, $page);
}

public function stopAtPage($page)
{
return $this->setOption(C::_L, $page);
}

protected function pageRangeOptions()
{
return [
C::_F => C::T_INTEGER,
C::_L => C::T_INTEGER,
];
}
}

0 comments on commit a9ea2de

Please sign in to comment.