Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Smalot/PdfParser/RawData/RawDataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected function decodeXref(string $pdfData, int $startxref, array $xref = [],
// initialize object number
$obj_num = 0;
// search for cross-reference entries or subsection
while (preg_match('/([0-9]+)[\x20]([0-9]+)[\x20]?([nf]?)(\r\n|[\x20]?[\r\n])/', $pdfData, $matches, \PREG_OFFSET_CAPTURE, $offset) > 0) {
while (preg_match('/([0-9]+)[\x20]+([0-9]+)[\x20]*([nf]?)(\r\n|[\x20]*[\r\n])/', $pdfData, $matches, \PREG_OFFSET_CAPTURE, $offset) > 0) {
if ($matches[0][1] != $offset) {
// we are on another section
break;
Expand Down
7 changes: 7 additions & 0 deletions tests/PHPUnit/Integration/DocumentIssueFocusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,11 @@ public function testPDFDocEncodingDecode(): void
$testSubject = '•†‡…—–ƒ⁄‹›−‰„“”‘’‚™ŁŒŠŸŽıłœšž';
self::assertStringContainsString($testSubject, $details['Subject']);
}

public function testParseFileWithXrefSubsectionHavingMultipleSpaces(): void
{
$document = (new Parser())->parseFile($this->rootDir.'/samples/bugs/PullRequestXrefSubsectionMultipleSpaces.pdf');

self::assertCount(1, $document->getPages());
}
}
Loading