Skip to content

Commit

Permalink
fix: make compatible with FPDF
Browse files Browse the repository at this point in the history
I identified an edge case parsing a PDF generated with FPDF. The MediaBox don't exists at page scope and was necessary to get from document scope.

Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 5, 2024
1 parent e3bf5a3 commit a60ba4a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Service/PdfParserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private function parsePdfOnlyWithPhp(string $filename): array {
];
foreach ($pages as $page) {
$details = $page->getDetails();
if (!isset($details['MediaBox'])) {
$details = reset($pdf->getObjectsByType('Pages'))->getHeader()->getDetails();
}
$output['d'][] = [
'w' => $details['MediaBox'][2],
'h' => $details['MediaBox'][3]
Expand Down

0 comments on commit a60ba4a

Please sign in to comment.