Skip to content

Commit

Permalink
Update allowed_protocols config for compatibility with Dompdf v3.1 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wout-o authored Jan 21, 2025
1 parent d2b3a15 commit 8d698b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/dompdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
* @var array
*/
'allowed_protocols' => [
'data://' => ['rules' => []],
'file://' => ['rules' => []],
'http://' => ['rules' => []],
'https://' => ['rules' => []],
Expand Down
10 changes: 10 additions & 0 deletions tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,14 @@ public function testMultipleInstances(): void
$this->assertEquals('host1', $pdf1->getDomPDF()->getBaseHost());
$this->assertEquals('host2', $pdf2->getDomPDF()->getBaseHost());
}

public function testDataImage(): void
{
$pdf = Facade\Pdf::loadHTML('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAEklEQVR4nGP8z4APMOGVHbHSAEEsAROxCnMTAAAAAElFTkSuQmCC" />');
$response = $pdf->download('test.pdf');

$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals(1424, strlen($response->getContent()));
}
}

0 comments on commit 8d698b4

Please sign in to comment.