barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.74k stars 971 forks source link

Method `setHttpContext` for avoid using `getDomPDF` #871

Closed erikn69 closed 2 years ago

erikn69 commented 2 years ago

https://github.com/dompdf/dompdf/blob/116404a740f937cb40534fa559468206e5bf9023/src/Dompdf.php#L1236-L1246

If you use getDomPDF for setHttpContext, you can't keep concatenating methods

Example:

return PDF::loadView('pdf')
    ->setHttpContext(['ssl'=>['verify_peer'=>false, 'verify_peer_name'=>false, 'allow_self_signed'=>true]])
    ->stream();

Before:

$pdf = PDF::loadView('pdf');
$pdf->getDomPDF()
    ->setHttpContext(
        stream_context_create(['ssl'=>['verify_peer'=>false, 'verify_peer_name'=>false, 'allow_self_signed'=>true]])
    );
return $pdf->stream();
barryvdh commented 2 years ago

Fixed with #892