Skip to content

Commit

Permalink
Update ElementName.php (#369)
Browse files Browse the repository at this point in the history
I removed group naming from the regular expression to decrease memory usage and improve performance, in very large files I was experiencing memory limit problems.
  • Loading branch information
mardc21 committed Dec 15, 2020
1 parent dc1e422 commit 46a1b53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Smalot/PdfParser/Element/ElementName.php
Expand Up @@ -64,8 +64,8 @@ public function equals($value)
*/
public static function parse($content, Document $document = null, &$offset = 0)
{
if (preg_match('/^\s*\/(?P<name>[A-Z0-9\-\+,#\.]+)/is', $content, $match)) {
$name = $match['name'];
if (preg_match('/^\s*\/([A-Z0-9\-\+,#\.]+)/is', $content, $match)) {
$name = $match[1];
$offset += strpos($content, $name) + \strlen($name);
$name = Font::decodeEntities($name);

Expand Down

0 comments on commit 46a1b53

Please sign in to comment.