Skip to content

Commit

Permalink
make pdtToText work
Browse files Browse the repository at this point in the history
  • Loading branch information
videni committed Apr 28, 2018
1 parent 27f912c commit a0df681
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 a0df681

Please sign in to comment.