Skip to content

Commit

Permalink
Merge pull request #54 from black-silence/master
Browse files Browse the repository at this point in the history
adjust section splitting for empty section
  • Loading branch information
smalot committed Dec 31, 2014
2 parents b5c4745 + 53ecfec commit 2ad086f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Smalot/PdfParser/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ public function getSectionsText($content)
$textCleaned = $this->cleanContent($content, '_');

// Extract text blocks.
if (preg_match_all('/\s+BT[\s|\(|\[]+(.*?)\s+ET/s', $textCleaned, $matches, PREG_OFFSET_CAPTURE)) {
if (preg_match_all('/\s+BT[\s|\(|\[]+(.*?)\s*ET/s', $textCleaned, $matches, PREG_OFFSET_CAPTURE)) {
foreach ($matches[1] as $part) {
$text = $part[0];
if ($text === '') {
continue;
}
$offset = $part[1];
$section = substr($content, $offset, strlen($text));

Expand Down

0 comments on commit 2ad086f

Please sign in to comment.