Skip to content

Commit

Permalink
hot fix - revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien MALOT committed Mar 18, 2015
1 parent 16e15dd commit da38fd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
14 changes: 4 additions & 10 deletions src/Smalot/PdfParser/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,7 @@ public function getPages()

/** @var Pages $object */
$object = $this->objects[$id]->get('Pages');
$pages = null;

if ($object) {
$object->getPages(true);
}
$pages = $object->getPages(true);

return $pages;
} elseif (isset($this->dictionary['Pages'])) {
Expand Down Expand Up @@ -253,11 +249,9 @@ public function getText(Page $page = null)
$texts = array();
$pages = $this->getPages();

if (is_array($pages)) {
foreach ($pages as $index => $page) {
if ($text = trim($page->getText())) {
$texts[] = $text;
}
foreach ($pages as $index => $page) {
if ($text = trim($page->getText())) {
$texts[] = $text;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Smalot/PdfParser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function parseFile($filename)
{
$content = file_get_contents($filename);

return $this->parseContent($content);
return @$this->parseContent($content);
}

/**
Expand All @@ -85,7 +85,7 @@ public function parseContent($content)
{
// Create structure using TCPDF Parser.
ob_start();
$parser = new \TCPDF_PARSER(ltrim($content));
@$parser = new \TCPDF_PARSER(ltrim($content));
list($xref, $data) = $parser->getParsedData();
unset($parser);
ob_end_clean();
Expand Down
2 changes: 1 addition & 1 deletion src/Smalot/PdfParser/Tests/Units/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testParseFile()
$content = $page->getText();
$this->assert->string($content);
} catch (\Exception $e) {
if ($e->getMessage() != 'Secured pdf file are currently not supported.') {
if ($e->getMessage() != 'Secured pdf file are currently not supported.' && strpos($e->getMessage(), 'TCPDF_PARSER') != 0) {
throw $e;
}
}
Expand Down

0 comments on commit da38fd4

Please sign in to comment.